codeforces 476c Dreamoon and Sums
来源:互联网 发布:怎么添加打印机端口 编辑:程序博客网 时间:2024/05/22 06:11
点击打开链接
给你此公式 ,k的范围是[1,a],然后给你a和b,让你求满足此条件的x的和。
此公式可以化简为:x=k*mod(x,b)*b+mod(x,b) 即x=(k*b+1)*mod(x,b),k可以枚举,b已知,而mod(x,b)的取值是1~b,可以通过公式直接求出。
//171 ms 100 KB#include<stdio.h>#include<string.h>#define ll long long#define mod 1000000007int main(){ ll a,b; while(scanf("%I64d%I64d",&a,&b)!=EOF) { ll ans=0; for(ll i=1;i<=a;i++) { ll c=(i*b+1)%mod; ll d=((b-1)*b/2)%mod; ans=(ans+c*d)%mod; } printf("%I64d\n",ans); } return 0;}
0 0
- Codeforces 476C. Dreamoon and Sums
- codeforces 476C Dreamoon and Sums
- Codeforces 476C Dreamoon and Sums (水
- codeforces 476c Dreamoon and Sums
- codeforces 476c Dreamoon and Sums
- Codeforces 476C Dreamoon and Sums
- Codeforces 476C Dreamoon and Sums
- Codeforces 476C Dreamoon and Sums【思维】
- Dreamoon and Sums CodeForces - 476C
- CF 476C Dreamoon and Sums[数学]
- Code Forces 476C Dreamoon and Sums
- 【CODEFORCES】 A. Dreamoon and Sums
- C. Dreamoon and Sums(Codeforces Round #272)
- 【Codeforces】 477A Dreamoon and Sums
- Codeforces Round #272 (Div. 2) C Dreamoon and Sums(数学)
- 【CODEFORCES】 C. Dreamoon and Strings
- Dreamoon and Sums 数学
- 477 A. Dreamoon and Sums
- UVA - 10801 Lift Hopping (Dijkstra)
- 容器 第二节 重写equals和hashCode方法
- hibernate之13.hql(二)
- GitHub 优秀的 Android 开源项目
- HDU 5011 Game 【Nim博弈】
- codeforces 476c Dreamoon and Sums
- opengl教程
- CodeForces 486C Palindrome Transformation
- libevent2源码 min_heap
- Uva 644-Immediate Decodability(串)
- 备份基本原理
- C++ STL删除元素的一些案例
- 【树套树】【bzoj 3236】: [Ahoi2013]作业
- Send a Table