poj2409--Let it Bead(置换群+polya奇数)
来源:互联网 发布:eu域名注册 编辑:程序博客网 时间:2024/06/04 20:11
题目链接:点击打开链接
题目大意:给出m种颜色的小球,现在要求用n个串成一个环,经过旋转翻转后,能形成多少个不同的环。
参考:点击打开链接
#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>using namespace std ;#define LL __int64LL gcd(LL a,LL b) { return b == 0 ? a : gcd(b,a%b) ;}LL pow(LL x,LL k) { if( k == 1 ) return x ; LL s = pow(x,k/2) ; s = s*s ; if( k%2 ) s *= x ; return s ;}int main() { LL n , m , i , ans , num ; while( scanf("%I64d %I64d", &m, &n) && n+m != 0 ) { ans = 0 ; for(i = 0 ; i < n ; i++) ans += pow(m,gcd(n,i)) ; if( n%2 ) { ans += n*pow(m,n/2+1) ; } else { ans += n/2*pow(m,n/2) ; ans += n/2*pow(m,n/2+1) ; } printf("%I64d\n", ans/(n*2)) ; } return 0 ;}
2 0
- poj2409--Let it Bead(置换群+polya奇数)
- POJ2409--Let it Bead--Polya
- poj2409 Let it Bead(置换)
- 置换群Polya定理(poj 2409: Let it Bead)
- poj2409 Let it Bead polya定理
- polya定理 poj2409 Let it Bead
- POJ2409 Let it Bead【Polya定理】
- poj2409 Let it Bead(置换群+Polya定理+Burnside引理)
- poj2409 Let it Bead
- poj2409 Let it Bead
- POJ2409 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)
- poj2409 Let it Bead(polyal原理)
- poj 2409 Let it Bead(polya定理)
- [ACM] POJ 2409 Let it Bead (Polya计数)
- OSX工具集之——Theos
- linux 修改文件内容 vi命令
- Android闪屏问题如何Debug
- openflow详解
- 为什么我们应该为Ruby2.0的GC感到excited!
- poj2409--Let it Bead(置换群+polya奇数)
- iOS Layer动画的KeyPath
- Poj -2586 Y2K Accounting Bug--枚举
- 天声人語 20150728
- EL表达式截取字符串
- 创建子类对象时,父类构造函数中调用被子类重写的方法为什么调用的是子类的方法,而被子类重载的方法不会调用?
- VVDocumenter不能注释(没有反应)
- struct 和 typedef struct 区别和用法总结
- 微信支付Notice: Use of undefined constant CURLOP_TIMEOUT - assumed