[Polya] POJ 2409 Let it Bead
来源:互联网 发布:cr2怎么转换成jpg mac 编辑:程序博客网 时间:2024/05/18 21:08
水题...
#include<cstdio>#include<algorithm>using namespace std;typedef long long ll;ll Gcd(ll a,ll b){return b?Gcd(b,a%b):a;}inline ll Pow(ll a,ll b){ll ret=1;for (;b;b>>=1,a*=a)if (b&1)ret*=a;return ret;}int main(){ll c,n,ans;freopen("t.in","r",stdin);freopen("t.out","w",stdout);while (1){scanf("%lld%lld",&c,&n);if (!n && !c) break;ans=0;for (int i=1;i<=n;i++)ans+=Pow(c,Gcd(n,(ll)i));if (n&1)ans+=n*Pow(c,(n+1)>>1);elseans+=n/2*Pow(c,n/2)+n/2*Pow(c,n/2+1);printf("%lld\n",ans/2/n);}return 0;}
0 0
- POj 2409 Let it Bead ----- polya计数
- POJ 2409 Let it Bead Polya定理
- POJ 2409 Let it bead 【裸polya】
- poj 2409 Let it Bead Polya计数
- poj 2409 Let it Bead (polya)
- POJ 2409-Let it Bead(Polya计数)
- POJ 2409 - Let it Bead【Polya定理】
- POJ 2409 Let it Bead ACM Polya
- POJ 2409 Let it Bead(polya)
- 【POJ 2409】 Let it Bead(Polya)
- [Polya] POJ 2409 Let it Bead
- POJ 2409 Let it Bead (Polya) .
- poj 2409 Let it Bead Polya定理
- POJ 2409 Let it Bead (Polya)
- POJ 2409 Let it Bead (Polya计数)
- poj 2409 Let it Bead(polya)
- poj 2409 Let it Bead(polya定理)
- POJ 2409 Let it Bead polya 定理 和 置换
- codeforces_679B. Bear and Tower of Cubes(贪心+二分+dfs)
- [仙人掌DP] BZOJ 4316 小C的独立集
- Linux里如何查找文件内容
- 1014. Waiting in Line (30)
- Android 自定义View 字母索引条
- [Polya] POJ 2409 Let it Bead
- String.split函数
- SSH整合搭建
- 循环和递归神经网络 (RNN) 与 长短时记忆 (LSTM)
- Android studio动态调试smali
- 基于Bootstrap框架的图片轮播实现
- 万有引力(Law of universal gravitation)
- 反编译,APK ProGuard混淆打包及混淆原理
- 面向对象7