组合数学 - 波利亚定理 --- poj : 2154 Color

博客介绍了如何利用波利亚定理解决一个关于珠子染色的问题。当项链上有N个珠子和N种颜色时,需要计算可能的不同染色方案数量。通过分析旋转i个珠子的循环群,得出不动的染色方案数C(fi) = n^gcd(i,n),并提出当gcd(i,n)=g时,i的数量等于欧拉函数phi(y)。最后,给出了该问题的时间复杂度为O(n^(1/2))的解决方案。" 102874983,8583312,Python编程:从扫雷脚本到数据分析与网页解析,"['Python编程', '数据分析', '网页解析', 'Jupyter教程', '扫雷算法']
摘要由CSDN通过智能技术生成
 Color
Time Limit: 2000MS   Memory Limit: 65536K
Total Submissions: 7873   Accepted: 2565

Description

Beads of N colors are connected together into a circular necklace of N beads (N<=1000000000). Your job is to calculate how many different kinds of the necklace can be produced. You should know that the necklace might not use up all the N colors, and the repetitions that are produced by rotation around the center of the circular necklace are all neglected. 

You only need to output the answer module a given number P. 

Input

The first line of the input is an integer X (X <
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值