摘要: 源代码: #include<cstdio> int m,n,q,ans=1; int main() { scanf("%d%d%d",&m,&n,&q); //m的n次方,对q的取余运算。 m%=q; //为避免m*m率先溢出,首当其冲,对其进行取余运算。 while (n) { if (n&1) 阅读全文
posted @ 2016-02-10 09:17 【機關】 阅读(256) 评论(0) 推荐(0)
摘要: 源代码: #include<cstdio> #include<cstring> #include<queue> using namespace std; queue <int> h; int i[1001][1001],j[1001],n,k; //要想节省空间,会不会有更好的方法呢? bool f 阅读全文
posted @ 2016-02-04 21:17 【機關】 阅读(839) 评论(0) 推荐(0)
摘要: 源代码: #include<cstdio> #include<cstring> int n,i[1001][1001],f[1001][1001],ans; int main() { memset(i,0x3f,sizeof(i)); memset(f,0x3f,sizeof(f)); ans=10 阅读全文
posted @ 2016-02-04 16:09 【機關】 阅读(559) 评论(0) 推荐(0)
摘要: 一、构造质数表 (1)试除法 源代码: #include<cstdio> int n,s(1),i[1001]; int main() { scanf("%d",&n); i[1]=2; printf("2 "); for (int a=3;s<n;a++) { bool t(0); for (in 阅读全文
posted @ 2016-02-03 20:31 【機關】 阅读(1613) 评论(0) 推荐(0)
摘要: 源代码: #include<iostream> #include<cstdio> using namespace std; string s1,s2; int m,n,k(0); bool t(0); int main() { getline(cin,s1); getline(cin,s2); m= 阅读全文
posted @ 2016-02-02 21:08 【機關】 阅读(421) 评论(0) 推荐(0)
摘要: 源代码: #include<cstdio> #include<cstring> int i[1001]={0},m,n,x,ans(0); bool f[1001][1001]={0},h[1001]; bool x1(int t) { for (int a=1;a<=n;a++) if (f[t] 阅读全文
posted @ 2016-01-29 19:40 【機關】 阅读(650) 评论(0) 推荐(0)
摘要: 源代码: #include<cstdio> int n,i[1001][1001]; const int maxint=10000000; int main() { scanf("%d",&n); for (int a=1;a<=n;a++) for (int b=1;b<=n;b++) { sca 阅读全文
posted @ 2016-01-09 11:12 【機關】 阅读(594) 评论(0) 推荐(0)
摘要: 源代码: #include<cstdio> int i[1001][1001],n,k; bool f[1001]={0}; const int maxint=1061109567; int main() { scanf("%d%d",&n,&k); for (int a=1;a<=n;a++) f 阅读全文
posted @ 2016-01-09 10:57 【機關】 阅读(440) 评论(0) 推荐(0)
摘要: 源代码: #include<cstdio> int m,n,h[1001]={0}; bool f[1001][1001]={0}; const int maxint=1061109567; int main() { scanf("%d%d",&n,&m); for (int a=1;a<=m;a+ 阅读全文
posted @ 2016-01-08 22:04 【機關】 阅读(391) 评论(0) 推荐(0)
摘要: 源代码: #include<cstdio> #include<cstring> int m(1),n,k,i[1001],x[1001],y[1001],f[1001]; int main() { scanf("%d%d",&n,&k); for (int a=1;a<=n;a++) for (in 阅读全文
posted @ 2016-01-08 19:06 【機關】 阅读(612) 评论(0) 推荐(0)