您的位置:首页 > 其它

cf(#div1 A. Dreamoon and Sums)(数论)

2014-10-15 08:41 441 查看
A. Dreamoon and Sums

time limit per test
1.5 seconds

memory limit per test
256 megabytes

input
standard input

output
standard output

Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if

#include<cstdio>
#include<cstring>
#define LL __int64
#define mod 1000000007
int main()
{
LL  a,b;
LL sum;
while(scanf("%I64d%I64d",&a,&b)!=EOF)
{
sum=0;
for(LL j=1;j<=a;j++)
{
sum+=((j*b)%mod+1)%mod;
sum%=mod;
}
LL ans=(((b-1)*b)/2)%mod;
printf("%I64d\n",(sum*ans)%mod);
}
return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: