2017 多校3 1008 RXD and math
2017-08-02 20:23
417 查看
题目
http://acm.hdu.edu.cn/showproblem.php?pid=6063
根据公式打表,可以发现一个规律就是求和的结果正好就是n的k次方,然后快速幂取模即可。
http://acm.hdu.edu.cn/showproblem.php?pid=6063
根据公式打表,可以发现一个规律就是求和的结果正好就是n的k次方,然后快速幂取模即可。
#include<bits/stdc++.h> using namespace std; const long long int MOD=7+1e9; long long int poww(long long int n,long long int m) { long long int ans=1; while(m) { if(m&1)ans=ans*n%MOD; n=n*n%MOD; m>>=1; } return ans; } int main(){ long long int n,m; long long int cs=1; while(scanf("%lld%lld",&n,&m)!=EOF) { n=n%MOD; cout<<"Case #"<<cs++<<": "; cout<<poww(n,m)<<endl; } return 0; }
相关文章推荐
- HDU-2017 多校训练赛3-1008-RXD and math
- 2017 多校训练第三场 HDU 6063 RXD and math
- 17 多校 3 - 1008 - RXD and math(HDU 6063)
- HDU6063---RXD and math(2017多校联赛题目(???))
- (2017多校训练第三场)HDU - 6063 RXD and math 找规律 + 快速幂
- 2017 Multi-University Training Contest 3 solutions 1008 RXD and math
- 2017 Multi-University Training Contest - Team 3 1008 RXD and math
- HDU6063 [2017多校联合3] RXD and math 打表 快速幂
- HDU 6063 RXD and math+(快速幂)+多校联赛第三场
- hdoj 6063(2017 Multi-University Training Contest - Team 3) RXD and math
- 2017杭电多校联赛第三场-RXD and math (hdu6063) 找规律快速幂
- 2017 - 多校训练-3 - 1005 RXD and dividing
- H - RXD and math HDU - 6063 多校第三场
- 2017多校3 1005 RXD and dividing
- 2017 Multi-University Training Contest - Team 3 RXD and math
- 2017 多校训练第三场 HDU 6060 RXD and dividing
- HDU-2017 多校训练赛3-1005-RXD and dividing
- HDU6063 2017杭电多校联赛第三场-RXD and math
- 2017 多校3 hdu 6061 RXD and functions
- hdu 多校联赛 RXD and math