polya 定理
来源:互联网 发布:保定安全教育网络平台 编辑:程序博客网 时间:2024/05/17 02:20
对polya定理中循环节的理解:把相互变换的所有元素看成一组 , polya公式的次方项就是组数
一般对于手镯刚体变换模型只考虑旋转和翻转变换。
poj 2409
#include <stdio.h>
#include <math.h>
#include <vector>
#include <string>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <math.h>
#include <vector>
#include <string>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
using namespace std;
int main()
{
int c,s;
while(scanf("%d%d",&c,&s)&&(c||s))
{
long long ans=0;
for(int i=1;i<=s;i++)
{
ans+=pow(c,__gcd(s,i));
}
if(s%2==1)
{
ans+=s*pow(c,((s-1)/2+1));
}
else
{
ans+=(s/2)*pow(c,s/2);
ans+=(s/2)*pow(c,(s+2)/2);
}
printf("%lld\n",ans/(2*s));
}
return 0;
}
{
int c,s;
while(scanf("%d%d",&c,&s)&&(c||s))
{
long long ans=0;
for(int i=1;i<=s;i++)
{
ans+=pow(c,__gcd(s,i));
}
if(s%2==1)
{
ans+=s*pow(c,((s-1)/2+1));
}
else
{
ans+=(s/2)*pow(c,s/2);
ans+=(s/2)*pow(c,(s+2)/2);
}
printf("%lld\n",ans/(2*s));
}
return 0;
}
poj 1286
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)&&n!=-1)
{
long long ans=0;
for(int i=1;i<=n;i++)
{ ans+=pow(3,__gcd(n,i));
}
if(n%2==1)
{
ans+=n*pow(3,((n-1)/2+1));
}
else
{
ans+=(n/2)*pow(3,n/2);
ans+=(n/2)*pow(3,(n+2)/2);
}
printf("%lld\n",ans/(2*n));
}
return 0;
}
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)&&n!=-1)
{
long long ans=0;
for(int i=1;i<=n;i++)
{ ans+=pow(3,__gcd(n,i));
}
if(n%2==1)
{
ans+=n*pow(3,((n-1)/2+1));
}
else
{
ans+=(n/2)*pow(3,n/2);
ans+=(n/2)*pow(3,(n+2)/2);
}
printf("%lld\n",ans/(2*n));
}
return 0;
}
阅读全文
0 0
- polya定理
- polya定理
- polya定理
- Polya定理
- Polya定理
- polya 定理
- polya定理1286
- polya定理应用
- polya定理再小结
- Polya定理小结
- Polya定理,Burnside引理
- polya计数定理
- polya定理再小结
- POJ 2409 Polya定理
- poj 2409 polya定理
- Polya定理,Burnside引理
- poj 2409 polya定理
- poj 1286 polya定理
- sonar安装过程
- 快速解决:windows安装程序无法将windows配置为在此计算机的硬件上运行
- python备忘六:list 列表之序列通用操作
- 两数组找相同元素
- 如何矢量化编程
- polya 定理
- linux文件操作—获取文本中指定行的内容
- where子句
- 美团猫眼android模块化实战-可能是最详细的模块化实战
- 在SQL Server中创建用户角色及授权(使用SQL语句)
- 仿 今日头条布局:TabLayout+ViewPager+Fragment+ListView多条目加载+Webview
- php Restful设计
- CentOS上配置rsyslog客户端用以远程记录日志
- 笔记—自定义View之绘制基础