codeforces 476C Dreamoon and Sums
来源:互联网 发布:mysql 导入employees 编辑:程序博客网 时间:2024/05/01 02:36
设x=n*b+t,,t的范围是1到b-1, 则[div(x,b)/mod(x,b)]=[(n*b+t)/(t*b)]=k,[]代表向下取整,[(n*b+t)/(t*b)]=(n*b)/(t*b)=k,所以n=t*k,即x=t*k*b+t=t*(k*b+1)。
用等差数列求和公式即可推出sum=(b-1)*b/2*(b*a*(a+1)/2+a) .
#include <iostream>#include<cstdio>#include<cstring>#define ll long long#define mod 1000000007using namespace std;int main(){ ll a,b,ans=0; scanf("%I64d%I64d",&a,&b); ans=((b-1)*b/2)%mod*((b*(a*(a+1)/2%mod)+a)%mod); printf("%I64d\n",ans%mod); 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
- mac安装pip
- 注意事项
- 单例设计模式
- 几种解决php+mysql中uft-8中文编码乱码的办法
- The type org.springframework.dao.support.DaoSupport cannot be resolved.
- codeforces 476C Dreamoon and Sums
- malloc和new的区别是什么?
- POJ 2187--Beauty Contest
- 一个简单的schema介绍
- 每周算法练习——n皇后问题
- 关闭图形界面上网功能
- Hibernate目录结构以及环境搭建
- 图像处理—灰度处理
- debug hdu 4462