2019牛客国庆集训派对day1 F-4 Buttons

题目链接:https://ac.nowcoder.com/acm/contest/1099/F

解题心得:以 ( 0 , 0 ) (0,0) (0,0)为原点将整个图划分成四个象限,如果单单看一个象限(不包含坐标轴)很容易找到规律,可以直接将四个象限的数量找到然后再计算在坐标轴上的点就行了。



#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn = 2e4+100;
const int mod = 1e9+7;

ll n, a, b, c, d, sum;

int main() {
//    freopen("1.in.txt", "r", stdin);
    while(scanf("%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d) != EOF) {
        sum = n*(n-1)/2%mod;
        ll ans = 0;
        ans = (ans + a*b%mod*sum)%mod;
        ans = (ans + b*c%mod*sum)%mod;
        ans = (ans + c*d%mod*sum)%mod;
        ans = (ans + d*a%mod*sum)%mod;

        ans = (ans + a*n + b*n + c*n + d*n + 1)%mod;

        printf("%lld\n", ans);
    }
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值