poj 1286 polya定理

时间:2019-08-14
本文章向大家介绍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\) 的循环节数(阶)

原文地址:https://www.cnblogs.com/mooleetzi/p/11355215.html