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
View Code
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
相关文章推荐
- Codeforces Round #272 (Div. 2)C. Dreamoon and Sums 数学推公式
- Codeforces Round #272 (Div. 2) C. Dreamoon and Sums 数学
- cf(#div1 B. Dreamoon and Sets)(数论)
- 【Codeforces Round 272 (Div 2)C】【暴力】Dreamoon and Sums 所有除b结果是模b结果[1,a]倍数字之和
- Codeforces Round #272 (Div. 2) C Dreamoon and Sums(数学)
- Codeforces Round #272 (Div. 2) C. Dreamoon and Sums 数学
- CF 476C Dreamoon and Sums[数学]
- Codeforces Round #272 (Div. 2) C. Dreamoon and Sums (数学 思维)
- Codeforces 476C Dreamoon and Sums (水
- cf 372 div2 E. Sonya and Problem Wihtout a Legend dp
- 【CF】121 Div.1 C. Fools and Roads
- Codeforces Round #272 (Div. 2) Dreamoon and WiFi 暴力
- E. Soldier and Traveling(CF546E) Codeforces Round #304 (Div. 2)
- 【CF】259 Div.1 B Little Pony and Harmony Chest
- CF 299 div2 D. Tavas and Malekas(KMP)
- 数论/暴力 Codeforces Round #305 (Div. 2) C. Mike and Frog
- CF(#294 div2):D. A and B and Interesting Substrings
- Codeforces Round #272 (Div. 2) B. Dreamoon and WiFi (超几何分布)
- Codeforces Round #383 (Div. 2) B. Arpa’s obvious problem and Mehrdad’s terrible solution 数论、易错
- [CF Round #294 div2] D. A and B and Interesting Substrings 【Map】