其他分享
首页 > 其他分享> > poj 1286 polya定理

poj 1286 polya定理

作者:互联网

Necklace of Beads

Description

Beads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repetitions that are produced by rotation around the center of the circular necklace or reflection to the axis of symmetry are all neglected, how many different forms of the necklace are there?

Input

The input has several lines, and each line contains the input data n.
-1 denotes the end of the input file.

Output

The output should contain the output data: Number of different forms, in each line correspondent to the input data.

Sample Input

4
5
-1

Sample Output

21
39

Solution

polya定理模板题

polya定理
设\(G\overline\)是n个对象的一个置换群, 用m种颜色染图这n个对象,则不同的染色方案数为:
\[L=\frac{1}{|G\overline|}[m^{c({p_1}\overline})+m^{c({p_2}\overline})+...+m^{c({p_g}\overline})]\]
其中 \(G\overline={p_1\overline,p_2\overline,...,p_g\overline}\), \(c(p_k\overline)\)为 \(p_k\overline\) 的循环节数(阶)

标签:1286,定理,overline,poj,necklace,input,polya,data
来源: https://www.cnblogs.com/mooleetzi/p/11355215.html