首页 技术 正文
技术 2022年11月11日
0 收藏 597 点赞 3,433 浏览 791 个字

http://poj.org/problem?id=2409

Burnside引理:设\(G\)是\(X\)的置换群,而\(\mathcal{C}\)是\(X\)中一个满足下面条件的着色集合:对于\(G\)中所有的\(f\)和\(\mathcal{C}\)中所有的\(\mathbf{c}\)都有\(f*\mathbf{c}\)仍在\(\mathcal{C}\)中,则\(\mathcal{C}\)中非等价着色数\(N(G,\mathcal{C})\)由下式给出:$$N(G,\mathcal{C})=\frac 1{|G|}\sum_{f\in G}|\mathcal{C}(f)|$$

换言之,\(\mathcal{C}\)中非等价的着色数等于在\(G\)中的置换作用下保持不变的着色的平均数。

直接套用定理就可以了qwq

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;int ipow(int a, int b) {
int ret = 1, w = a;
while (b) {
if (b & 1) ret *= w;
w *= w;
b >>= 1;
}
return ret;
}int c, s, ans, half;int gcd(int a, int b) {return b ? gcd(b, a % b) : a;}int main() {
while (~scanf("%d%d", &c, &s)) {
if (c == 0 && s == 0) break;
ans = 0;
for (int i = 1; i <= s; ++i)
ans += ipow(c, gcd(i, s));
half = (s + 1) >> 1;
if (s & 1)
ans += s * ipow(c, half);
else
ans += (s >> 1) * (ipow(c, half) + ipow(c, half + 1));
printf("%d\n", ans / (s << 1));
}
return 0;
}
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,022
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,513
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,359
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,142
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,773
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,851