POJ 1286 Necklace of Beads ——Burnside
【题目分析】
题目大意:一个环有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的更多相关文章
- 数学计数原理(Pólya):POJ 1286 Necklace of Beads
Necklace of Beads Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7763 Accepted: 3247 ...
- POJ 1286 Necklace of Beads(项链的珠子)
Necklace of Beads Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7874 Accepted: 3290 ...
- poj 1286 Necklace of Beads & poj 2409 Let it Bead(初涉polya定理)
http://poj.org/problem?id=1286 题意:有红.绿.蓝三种颜色的n个珠子.要把它们构成一个项链,问有多少种不同的方法.旋转和翻转后同样的属于同一种方法. polya计数. 搜 ...
- POJ 1286 Necklace of Beads(Polya简单应用)
Necklace of Beads 大意:3种颜色的珠子,n个串在一起,旋转变换跟反转变换假设同样就算是同一种,问会有多少种不同的组合. 思路:正规学Polya的第一道题,在楠神的带领下,理解的还算挺 ...
- 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 ...
- poj 1286 Necklace of Beads【polya定理+burnside引理】
和poj 2409差不多,就是k变成3了,详见 还有不一样的地方是记得特判n==0的情况不然会RE #include<iostream> #include<cstdio> us ...
- POJ 1286 Necklace of Beads(Polya原理)
Description Beads of red, blue or green colors are connected together into a circular necklace of n ...
- 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. ...
- poj 1286 Necklace of Beads (polya(旋转+翻转)+模板)
Description Beads of red, blue or green colors are connected together into a circular necklace of ...
随机推荐
- mac下相关操作命令
查看端口使用情况 lsof -i tcp:
- webpack前端构建工具学习总结(三)之webpack.config.js配置文件
Webpack 在执行的时候,除了在命令行传入参数,还可以通过指定的配置文件来执行.默认情况下,会搜索当前目录的 webpack.config.js 文件,这个文件是一个 node.js 模块,返回一 ...
- 洛谷 P2264 情书
题目背景 一封好的情书需要撰写人全身心的投入.lin_toto同学看上了可爱的卡速米想对她表白,但却不知道自己写的情书是否能感动她,现在他带着情书请你来帮助他. 题目描述 为了帮助lin_toto,我 ...
- The Singapore NRIC Check Digit
The Singapore NRIC number is made up of 7 digits and a letter behind. This letter is calculated from ...
- eclipse报错MA
今天有个总监晒了张tomcat7.0崩溃忘记怎么搞了,大家都在吐槽"一个[总监](经常水群)竟然不会这个".敲上来. Problem Occurred系列: 'Starting T ...
- rhythmbox插件开发笔记2:背景知识学习 D-Bus&VFS&Gio& Python GTK+ 3
这次主要简单介绍下相关的背景知识 D-Bus&VFS&Gio& Python GTK+ 3 D-Bus D-Bus是开源的进程通信(IPC)系统,它允许多个进程进行实时通信. ...
- aspose.cell 给excel表格设置样式
方法1: Style styleTitle = workbook.Styles[workbook.Styles.Add()];//新增样式 styleTitle.HorizontalAlignment ...
- "Mac OS X"录屏幕视频并转成gif
第一步: 使用软件QuickTime Player录屏幕视频,创建方式选择新建屏幕录制: 选择区域录制,录好保存后,就需要转gif,需要另外一个软件. 第二步: 使用GIFBrewery软件创建gif ...
- linux yum 安装mysql
1.安装查看有没有安装过: yum list installed MySQL* rpm -qa | grep mysql* 查看有没有安装包: yum list mysql* 安装mysql客户端: ...
- 企业自颁布服务器证书的有效性验证(C#为例)
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/notjusttech/article/details/72779904 目前根据项目的需要,整理了一 ...