HDU6063:RXD and math(数论)
2018-01-19 11:11
429 查看
题面
题意:
∑i=1nkμ2(i)∗nki−−−√
1~n的每个数都可以写成a∗b2,都对应1个a。a无平方因子。
循环就相当于枚举a,剩下的是算出有多少个b。
没问题,妥妥的。
题意:
∑i=1nkμ2(i)∗nki−−−√
1~n的每个数都可以写成a∗b2,都对应1个a。a无平方因子。
循环就相当于枚举a,剩下的是算出有多少个b。
没问题,妥妥的。
#include <iostream> #include <fstream> #include <algorithm> #include <cmath> #include <ctime> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; #define mmst(a, b) memset(a, b, sizeof(a)) #define mmcp(a, b) memcpy(a, b, sizeof(b)) typedef long long LL; const LL mo=1e9+7; LL jia(LL a,LL b) { LL res=0; for(;b;b>>=1,a=(a+a)%mo) if(b&1) res=(res+a)%mo; return res; } LL cheng(LL a,LL b) { LL res=1; for(;b;b>>=1,a=jia(a,a)) if(b&1) res=jia(res,a); return res; } LL n,k,tu=1; int main() { while(~scanf("%lld%lld",&n,&k)) { printf("Case #%lld: %lld\n",tu,cheng(n,k)); tu++; } return 0; }
相关文章推荐
- hdu6063 RXD and math
- Hdu6063 RXD and math(2017多校第3场)
- HDU 6063 RXD and math(数论)
- HDU6063---RXD and math(2017多校联赛题目(???))
- HDU6063-RXD and math
- [hdu6063]RXD and math
- HDU6063-RXD and math
- HDU6063 RXD and math
- HDU6063 RXD and math 快速幂
- hdu6063-RXD and math
- HDU6063 2017杭电多校联赛第三场-RXD and math
- HDU6063 [2017多校联合3] RXD and math 打表 快速幂
- 2017杭电多校联赛第三场-RXD and math (hdu6063) 找规律快速幂
- hdu 多校联赛 RXD and math
- hdoj 6063(2017 Multi-University Training Contest - Team 3) RXD and math
- HDU 6063-RXD and math
- RXD and math(HDU 6063 快速幂)
- hdu--6063 RXD and math
- hdu 6063 RXD and math (规律题)
- 2017多校联合三/hdu6063 ( RXD and math )快速幂+思维