POJ 2409 Let it Bead(Polya定理)
题意 :给你c种颜色的n个珠子,问你可以组成多少种形式。
思路 :polya定理的应用,与1286差不多一样,代码一改就可以交。。。。POJ 1286题解
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <math.h>
#include <algorithm> using namespace std; int gcd(int a,int b)
{
return b > ? gcd(b,a%b) : a ;
}
int main()
{
int c,s ;
while (scanf("%d %d", &c, &s) != EOF)
{
if(c == && s == ) break ;
int sum = ;
for (int i = ; i <= s; i++)
sum += pow(c, gcd(i, s));
if (s & )
sum += s * pow(c, s / + );
else
sum += s / * pow(c, s / ) + s / * pow(c, s / + );
sum /= s * ;
printf("%d\n", sum);
}
return ;
}
POJ 2409 Let it Bead(Polya定理)的更多相关文章
- POJ 2409 Let it Bead (Polya定理)
题意 用k种颜色对n个珠子构成的环上色,旋转翻转后相同的只算一种,求不等价的着色方案数. 思路 Polya定理 X是对象集合{1, 2, --, n}, 设G是X上的置换群,用M种颜色染N种对象,则不 ...
- poj 2409 Let it Bead Polya计数
旋转能够分为n种置换,相应的循环个数各自是gcd(n,i),个i=0时不动,有n个 翻转分为奇偶讨论,奇数时有n种置换,每种有n/2+1个 偶数时有n种置换,一半是n/2+1个,一半是n/2个 啃论文 ...
- [ACM] POJ 2409 Let it Bead (Polya计数)
参考:https://blog.csdn.net/sr_19930829/article/details/38108871 #include <iostream> #include < ...
- poj 1286 Necklace of Beads & poj 2409 Let it Bead(初涉polya定理)
http://poj.org/problem?id=1286 题意:有红.绿.蓝三种颜色的n个珠子.要把它们构成一个项链,问有多少种不同的方法.旋转和翻转后同样的属于同一种方法. polya计数. 搜 ...
- POJ 2409 Let it Bead:置换群 Polya定理
题目链接:http://poj.org/problem?id=2409 题意: 有一串n个珠子穿起来的项链,你有k种颜色来给每一个珠子染色. 问你染色后有多少种不同的项链. 注:“不同”的概念是指无论 ...
- poj 2409 Let it Bead【polya定理+burnside引理】
两种置换 旋转:有n种,分别是旋转1个2个--n个,旋转i的循环节数位gcd(i,n) 翻转:分奇偶,对于奇数个,只有一个珠子对一条边的中点,循环节数为n/2+1:对于偶数个,有珠子对珠子和边对边,循 ...
- POJ 2409 Let it Bead(polya裸题)
题目传送:http://poj.org/problem?id=2409 Description "Let it Bead" company is located upstairs ...
- POJ 2409 Let it Bead 组合数学
题目地址: http://poj.org/problem?id=2409 给你一串珠子有m个,用n种不同的颜色涂色,问有多少种分法. 用polay定理求解,对于排成一排的带编号的小球,按照某一种方案改 ...
- bzoj 1004 [HNOI2008]Cards && poj 2409 Let it Bead ——置换群
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1004 http://poj.org/problem?id=2409 学习材料:https:/ ...
随机推荐
- oracle EBS中使用PLSQL提交"关闭离散"并发请求
declare l_request_id number; l_return_flag boolean; l_num_user_id number; l_num_resp_id number; l_nu ...
- Linux基础(二)
二.Linux 常用命令 一.命令行操作的流程 录入命令(可以使用各种途径来发送命令) 命令被解释器解释并执行 将结果以产品需要的方式显示出来 二.命令提示符 sq@sq-VirtualBox:~$ ...
- samba服务器与远程登录ssh
作者:相思羽 出处:http://www.cnblogs.com/xiang-siyu 欢迎转载,也请保留这段声明.谢谢! deepin安装与配置samba服务器 安装 apt-get insta ...
- jQuery 定时局部刷新(setInterval)方法总结
来自:http://www.jbxue.com/article/8516.html 1.jQuery 定时局部刷新(setInterval),显示时间的代码. <head> <scr ...
- 让你一分钟认识电子身份验证系统EID
什么是EID eID是英文"Electronic Identity"的英文简称,中文名为"电子身份证"或"网络电子身份证",由公安部第三研究 ...
- Come and join us at English corner
2012.12.26 Hi all, How are you doing? Merry post-Christmas and happy upcoming New year!! I wish you ...
- HOOK函数(二)——全局HOOK
如果钩子函数定义于当前进程相关的线程中,则钩子函数只能处理当前进程的线程的消息,如果要想处理当前正在运行的所有进程的鼠标消息和键盘消息,那么安装钩子函数的代码必须实现在动态链接库中.所以如果想让安装的 ...
- JS获取日期和时间
//获取日期和时间 function showDate(){ var myDate = new Date(); myDate.getYear(); //获取当前年份(2位) myDate.getFul ...
- C# 内存法图像处理
内存法通过把图像储存在内存中进行处理,效率大大高于GetPixel方法,安全性高于指针法. 笔者当初写图像处理的时候发现网上多是用GetPixel方法实现,提到内存法的时候也没有具体实现,所以笔者在这 ...
- let和const====均参考阮大神的es6入门
// 解构复制// let [foo,[[bar],baz]] = [1,[[2],3]];// console.log(foo);//1// console.log(bar);//2// conso ...