poj2409 Let it Bead】的更多相关文章

                                                                  Let it Bead Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5397   Accepted: 3609 Description "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey…
Let it Bead Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6443   Accepted: 4315 Description "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is b…
题目描述 "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department found out that customers are interested in buying colored bracelets. However…
题目大意:长度为n的项链,要染m种颜色,可以通过旋转或翻转到达的状态视为同一种,问有多少种染色方案. 学了一波polya定理,发现很好理解啊,其实就是burnside定理的扩展. burnside定理告诉我们不同染色方案数是每种置换的不变元素个数除以置换总数,而polya定理就是在这个基础上用公式计算出置换的不变元素个数.而且polya定理非常好理解,我们要让元素不变,所以对于每个循环节我们要染一样的颜色,有m种颜色,c(pk)个循环节,于是每种置换的不变元素个数就是m^c(pk). 对于这道题…
原文链接www.cnblogs.com/zhouzhendong/p/Burnside-Polya.html 问题模型 有一个长度为 $n$ 的序列,序列中的每一个元素有 $m$ 种取值. 如果两个序列循环同构,那么我们称这两个序列等价. 求两两不等价的序列个数. Burnside引理 假设有若干个置换 $P_1,P_2,\cdots$ ,设由这些置换生成的置换群为 $Q$ .如果序列 A 可以通过一个 $Q$ 中的置换变成序列 B,那么我们认为 A 和 B 等价. 对于一个置换 $P$ ,如果…
公式: Burnside引理: 1/|G|*(C(π1)+C(π2)+C(π3)+.....+C(πn)): C(π):指不同置换下的等价类数.例如π=(123)(3)(45)(6)(7),X={1,2,3,4,5,6,7};那么C(π)={3,6,7}共3个等价类. Polya定理: 1/|G|*(mC(π1)+mC(π2)+mC(π3)+...+mC(πk)). 设G={π1,π2,π3........πn}是X={a1,a2,a3.......an}上一个置换群, 其中C(πk)为置换πk…
[POJ2409]Let it Bead 题意:用$m$种颜色去染$n$个点的环,如果两个环在旋转或翻转后是相同的,则称这两个环是同构的.求不同构的环的个数. $n,m$很小就是了. 题解:在旋转$i$次后,循环节的个数显然是$gcd(i,n)$. 如果考虑翻转,我们将点从$0$到$n-1$标号,令其先以0到圆心的连线为对称轴翻转,再旋转i次,则原来编号为x的会变成$n-x+i \mathrm{mod} n$,令$n-x+i=x \mathrm{mod} n$,则$2x=i$或$2x=n+i$.…
http://poj.org/problem?id=2409 (题目链接) 题意 一个n个珠子的项链,每个珠子可以被染成t种颜色.项链可以翻转和旋转,问不同的染色方案数. Solution Pólya定理. 旋转:如果逆时针旋转i颗珠子的间距,则珠子0,i,2i,······构成一个循环.这个循环有n/gcd(n,i)个元素.根据对称性,所有循环的长度相同,因此一共有gcd(n,i)个循环.这些置换的不动点总数为${\sum_{i=0}^{n-1}  t^{gcd(i,n)}}$种,其中t为颜色…
题目描述 用 $c$ 种颜色去染 $r$ 个点的环,如果两个环在旋转或翻转后是相同的,则称这两个环是同构的.求不同构的环的个数. $r·c\le 32$ . 题解 Polya定理 Burnside引理:一个置换群的等价类数目等于这个置换群中所有置换的不动点数目的平均值:Polya定理:设有限群G有 $m$ 个置换,第 $i$ 个置换有 $a_i$ 个循环,现在要将所有的点染成 $c$ 种颜色,那么染色后群G的等价类数目为:$L=\frac{c^{a_1}+c^{a_2}+…+c^{a_m}}m$…
Let it Bead 大意:给你m种颜色,n个珠子串起来.旋转跟反转同样算同样,问有多少种不同的涂色组合方式. 思路:Polya的简单应用. /************************************************************************* > File Name: POJ2409.cpp > Author: GLSilence > Created Time: 2014年07月29日 星期二 22时56分58秒 ************…
描述 "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department found out that customers are interested in buying colored bracelets. However,…
http://poj.org/problem?id=2409 // File Name: poj2409.cpp // Author: bo_jwolf // Created Time: 2013年10月08日 星期二 14:31:08 #include<vector> #include<list> #include<map> #include<set> #include<deque> #include<stack> #include…
  Description Cannery Row percent of the target audience insists that the bracelets be unique. (Just imagine what happened if two women showed up at the same party wearing identical bracelets!) It's a good thing that bracelets can have different leng…
Description There are N beads which of the same shape and size, but with different weights. N is an odd number and the beads are labeled as 1, 2, ..., N. Your task is to find the bead whose weight is median (the ((N+1)/2)th among all beads). The foll…
题目传送:http://poj.org/problem?id=2409 Description "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department found out that customers are inte…
Median Weight Bead Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3162 Accepted: 1630 Description There are N beads which of the same shape and size, but with different weights. N is an odd number and the beads are labeled as 1, 2, -, N.…
描述 There are N beads which of the same shape and size, but with different weights. N is an odd number and the beads are labeled as 1, 2, ..., N. Your task is to find the bead whose weight is median (the ((N+1)/2)th among all beads). The following com…
Description There are N beads which of the same shape and size, but with different weights. N is an odd number and the beads are labeled as 1, 2, ..., N. Your task is to find the bead whose weight is median (the ((N+1)/2)th among all beads). The foll…
珠排序非常另类[地精也很另类],看完你就知道了,先介绍思路,再分解过程 这是它的英文论文 http://www.cs.auckland.ac.nz/~jaru003/research/publications/journals/beadsort.pdf 截图即从上边的论文里抓的屏 先了解一个概念,不然不容易理解,一个数字3用3个1来表示 一个数字9用9个1来表示,珠排序中的珠指的是每一个1,它把每一个1想像成一个珠子,这些珠子被串在一起,想像下算盘和糖葫芦 图1 上图1中的三个珠就表示数字3,两…
Let it Bead "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department found out that customers are interested in buying colored bracelets.…
Polya定理 L=1/|G|*(m^c(p1)+m^c(p2)+...+m^c(pk)) G为置换群大小 m为颜色数量 c(pi)表示第i个置换的循环节数 如置换(123)(45)(6)其循环节数为3 ------------------------------------------------------------------------------------------- POJ1286&POJ2409 都是简单的处理串珠子的问题. 题目中隐藏着3种不同的置换类别. 1.旋转 注意不…
1116: Let it Bead  Time Limit(Common/Java):1000MS/10000MS     Memory Limit:65536KByteTotal Submit: 7            Accepted:4 Description "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the compa…
Description "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department found out that customers are interested in buying colored bracelets.…
Median Weight Bead Time Limit: 1000ms Memory Limit: 30000KB This problem will be judged on PKU. Original ID: 197564-bit integer IO format: %lld      Java class name: Main   There are N beads which of the same shape and size, but with different weight…
BEAD 源程序名 BEAD.???(PAS,C,CPP) 可执行文件名 BEAD.EXE 输入文件名 BEAD.IN 输出文件名 BEAD.OUT 时间限制 1S 内存限制 128MB 有n颗形状和大小都一致的珍珠,它们的重量都不相同.n为整数,所有的珍珠从1到n编号.你的任务是发现哪颗珍珠的重量刚好处于正中间,即在所有珍珠的重量中,该珍珠的重量列(n+1)/2位.下面给出将一对珍珠进行比较的办法: 给你一架天平用来比较珍珠的重量,我们可以比出两个珍珠哪个更重一些,在作出一系列的比较后,我们可…
题目描述 有n颗形状和大小都一致的珍珠,它们的重量都不相同.n为整数,所有的珍珠从1到n编号.你的任务是发现哪颗珍珠的重量刚好处于正中间,即在所有珍珠的重量中,该珍珠的重量列(n+1)/2位.下面给出将一对珍珠进行比较的办法:给你一架天平用来比较珍珠的重量,我们可以比出两个珍珠哪个更重一些,在作出一系列的比较后,我们可以将某些肯定不具备中间重量的珍珠拿走. 例如,下列给出对5颗珍珠进行四次比较的情况: 1.珍珠2比珍珠1重 2.珍珠4比珍珠3重 3.珍珠5比珍珠1重 4.珍珠4比珍珠2重 根据以…
#include <iostream> #include <math.h> using namespace std; #define LL long long LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; } LL polya(LL n) { LL ret = ; ; i < n; i++) ret += pow(, gcd(i, n)); //flip them... )//odd ret += n * pow(, n…
题目链接:http://poj.org/problem?id=2409 题意:给出一个长度为m的项链,每个珠子可以用n种颜色涂色.翻转和旋转后相同的算作一种.有多少种不同的项链? 思路: (1) 对于Burnside引理,G为所有置换集合,|G|为所有置换个数,gi为第i种置换,D(gi)为在第i种置换下保持不动的元素个数. 对于Polay定理,G为所有置换集合,|G|为所有置换个数,gi为第i种置换,n为颜色的种类,c(gi)为第i种置换的循环节个数. (2)对于Polay,一般解题步骤:确定…
题目:http://poj.org/problem?id=2409 题意:用k种不同的颜色给长度为n的项链染色 网上大神的题解: 1.旋转置换:一个有n个旋转置换,依次为旋转0,1,2,```n-1.对每一个旋转置换,它循环分解之后得到的循环因子个数为gcd(n,i). 2.翻转置换:分奇偶讨论. 奇数的时候 翻转轴 = (顶点+对边终点的连线),一共有n个顶点,故有n个置换,且每个置换分解之后的因子个数为n/2+1; 偶数的时候 翻转轴 = (顶点+顶点的连线),一共有n个顶点,故有n/2个置…
思路:polya裸题,如果是旋转,对于旋转i格的循环节长度len=lcm(i,n)/i,个数就是n/len=gcd(i,n):如果是翻转,奇数个点对称轴就是一个点一条边,那么循环节个数即n/2+1, 偶数个点有n/2条对称轴穿过两个点,循环节个数是n/2+1,n/2条对称轴穿过两条边,循环节个数就是n/2,然后直接套polya公式即可. #include<iostream> #include<cstdio> #include<cstring> #include<a…