hdu 5833 Zhu and 772002
来源:互联网 发布:vb多线程实例 编辑:程序博客网 时间:2024/05/20 14:17
刘汝佳白皮书160页原题,差不多,今天应该反思下一个月来的成绩和不足,应该朝那个方向努力。
#include<iostream>#include<stdlib.h>#include<queue>#include<string.h>#include<stdio.h>using namespace std;const int maxn=2001;int prime[maxn],visit[maxn];int N=0;int b[2001][310];long long a[310];const int mod=1000000007;void init(){ for(long long i=2; i<maxn; i++) { if(!visit[i]) prime[N++]=i; for(long long j=0; j<N; j++) { long long k=i*prime[j]; if(k>maxn)break; visit[k]=1; } }}int mod_pow(int a,int b){ int res=1; a%=mod; while(b>0) { if(b&1)res=(res*a)%mod; a=(a*a)%mod; b/=2; } return res;}int rank1(int m,int n){ int k,r,u,i=0,j=0; while(i<m&&j<n) { r=i; for(k=i;k<m;k++) if(b[k][j]){r=k;break;} if(b[r][j]) { if(r!=i)for(k=0;k<=n;k++)swap(b[r][k],b[i][k]); for(u=i+1;u<m;u++) if((b[u][j])) for(k=i;k<=n;k++)b[u][k]^=b[i][k]; i++; } j++; } return i;} int main() { init(); int t,cnt=0; scanf("%d",&t); while(t--) { printf("Case #%d:\n",++cnt); memset(b,0,sizeof(b)); int n; scanf("%d",&n); int max1=0; for(int i=1;i<=n;i++) {scanf("%I64d",&a[i]); for(int j=0;j<N&&a[i]>=prime[j];j++) { if(a[i]%prime[j]==0) { long long tmp=0; while(a[i]%prime[j]==0) { tmp++; a[i]/=prime[j]; } b[j][i]=tmp%2; max1=max(max1,j); } } } int r=rank1(max1+1,n); r=n-r; cout<<mod_pow(2,r)-1<<endl; } return 0; }
阅读全文
0 0
- HDU 5833 Zhu and 772002
- HDU 5833 Zhu and 772002
- HDU 5833 Zhu and 772002
- hdu 5833 Zhu and 772002
- HDU-5833-Zhu and 772002
- Zhu and 772002 HDU
- Zhu and 772002 HDU
- Hdu-5833 Zhu and 772002(高斯消元)
- hdu 5833 Zhu and 772002(高斯消元)
- HDU 5833 Zhu and 772002 (高斯消元)
- HDU 5833 Zhu and 772002 (高斯求元)
- HDU 5833 Zhu and 772002 (高斯消元)
- HDU 5833 Zhu and 772002 高斯消元
- HDU 5833 Zhu and 772002(高斯消元)
- [HDU 5833] Zhu and 772002 (高斯消元)
- HDU-5833-Zhu and 772002(高斯消元)
- HDU 5833 Zhu and 772002 网络赛
- hdu 5833 Zhu and 772002 高斯消元
- cocos2dx 3.x TableView多行多列的使用
- 用kolla部署openstack遇到的问题总结
- opencv2.4.8和ffmpeg2.1.8安装说明
- HDU 6146 && 2017 百度之星复赛 1003 Pokémon GO(递推)
- 浅谈HTTP状态码
- hdu 5833 Zhu and 772002
- QT编写cmd工具
- 区分数据库(database)和实例(instance)的概念
- 当Activity的launchMode设为singleTask的时候,你要注意了!
- 输入10个数求每个不同的数出现的次数算法
- java读取Excel的方法,解析xls、xlsx两种格式
- R语言读取xlsx文件
- Spring Boot 热部署
- 常用命令总结