【题目分析】

题目大意:一个环有n个点,共染三种颜色。问 在旋转和对称的情况下有多少种本质不同的方案数。

Burnside直接做。

【代码】

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std; #define ll long long
#define F(i,j,k) for (int i=j;i<=k;++i) ll f[25],pow[30];
int n; int gcd(int a,int b)
{return b==0?a:gcd(b,a%b);} int main()
{
f[0]=0;pow[0]=1;
F(i,1,23) pow[i]=pow[i-1]*3;
F(z,1,23)
{
F(i,0,z-1) f[z]+=pow[gcd(i,z)];
if (z&1) f[z]+=z*pow[z/2+1];
else f[z]+=z/2*pow[z/2],f[z]+=z/2*pow[z/2+1];
f[z]/=2*z;
}
while (scanf("%d",&n)&&n>=0)
printf("%lld\n",f[n]);
}

  

POJ 1286 Necklace of Beads ——Burnside的更多相关文章

  1. 数学计数原理(Pólya):POJ 1286 Necklace of Beads

    Necklace of Beads Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7763   Accepted: 3247 ...

  2. POJ 1286 Necklace of Beads(项链的珠子)

    Necklace of Beads Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7874   Accepted: 3290 ...

  3. poj 1286 Necklace of Beads &amp; poj 2409 Let it Bead(初涉polya定理)

    http://poj.org/problem?id=1286 题意:有红.绿.蓝三种颜色的n个珠子.要把它们构成一个项链,问有多少种不同的方法.旋转和翻转后同样的属于同一种方法. polya计数. 搜 ...

  4. POJ 1286 Necklace of Beads(Polya简单应用)

    Necklace of Beads 大意:3种颜色的珠子,n个串在一起,旋转变换跟反转变换假设同样就算是同一种,问会有多少种不同的组合. 思路:正规学Polya的第一道题,在楠神的带领下,理解的还算挺 ...

  5. poj 1286 Necklace of Beads poj 2409 Let it Bead HDU 3923 Invoker <组合数学>

    链接:http://poj.org/problem?id=1286 http://poj.org/problem?id=2409 #include <cstdio> #include &l ...

  6. poj 1286 Necklace of Beads【polya定理+burnside引理】

    和poj 2409差不多,就是k变成3了,详见 还有不一样的地方是记得特判n==0的情况不然会RE #include<iostream> #include<cstdio> us ...

  7. POJ 1286 Necklace of Beads(Polya原理)

    Description Beads of red, blue or green colors are connected together into a circular necklace of n ...

  8. poj 2409 Let it Bead && poj 1286 Necklace of Beads(Polya定理)

    题目:http://poj.org/problem?id=2409 题意:用k种不同的颜色给长度为n的项链染色 网上大神的题解: 1.旋转置换:一个有n个旋转置换,依次为旋转0,1,2,```n-1. ...

  9. poj 1286 Necklace of Beads (polya(旋转+翻转)+模板)

      Description Beads of red, blue or green colors are connected together into a circular necklace of ...

随机推荐

  1. docker 配置国内镜像源 linux/mac/windows

    部分内容来自:http://guide.daocloud.io/dcs/daocloud-9153151.html 加速器官方DaoCloud承诺:加速器服务永久免费且无流量限制 使用前提:注册Dao ...

  2. osx launchpad图标的删除

    安装了个parallels desktop之后,OSX中的launchpad中的图标多了不少,可是好多都不是我自己想要的,我们该怎么删除或者修改呢,下面介绍一些方法: ①直接操作Appications ...

  3. v-if与v-show的区别与选择

      v-if与v-show的区别与选择 官网给的区别 v-if 是“真正”的条件渲染,因为它会确保在切换过程中条件块内的事件监听器和子组件适当地被销毁和重建. v-if也是惰性的:如果在初始渲染时条件 ...

  4. OpenCascade:屏闪问题。

    1.在OnDraw中同时调用用V3d_View::Redaw()和 V3d_View::FitAll();可暂时解决. 2.在OnDraw中同时调用用V3d_View::Update();

  5. oracle调用子存储过程+游标循环实例

    一,有子节点的部门的子节点的排序,调用子存储过程 CREATE OR REPLACE PROCEDURE "PRO_INIT_SORT" AS CURSOR cur_departm ...

  6. fckeditor配置详解

    使用配置设置: . FCKConfig.CustomConfigurationsPath = '' ; // 自定义配置文件路径和名称 . FCKConfigFCKConfig.EditorAreaC ...

  7. bootstrap历练实例: 基本胶囊式的导航菜单

    <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...

  8. ulimit 值超出允许范围导致无法登陆操作系统

    在linux中,使用ulimit可以设置一些资源的使用限制. [root@root ~]# ulimit -a core file size          (blocks, -c) unlimit ...

  9. c++ 读取一行的2个数

    #include <iostream> using namespace std; double harmonicMean(double x, double y); int main() { ...

  10. 数据库事务ACID和事务的隔离级别

    借鉴:https://blog.csdn.net/zh521zh/article/details/69400053和https://blog.csdn.net/May_3/article/detail ...