X-man

导航

上一页 1 ··· 45 46 47 48 49 50 51 52 53 ··· 59 下一页

2013年5月22日 #

hdu 2441(ACM(Array Complicated Manipulation))

摘要: 打表规律猜想代码:#include<stdio.h>#include<string.h>const int N=100;int a[N];bool p[N];int main(){ memset(p,true,sizeof(p)); for(int i=0;i<N;i++) a[i]=i; for(int j=2;j<N;j++) { if(p[j]) { for(int k=2;j*k<N;k++) if(p[j*k])p[j*k]=false; else p[j*k]... 阅读全文

posted @ 2013-05-22 12:42 雨钝风轻 阅读(173) 评论(0) 推荐(0) 编辑

2013年5月20日 #

hdu 1576 A/B

摘要: #include<stdio.h>int main(){ int _case,a; int n,b; scanf("%d",&_case); while(_case--) { scanf("%d%d",&n,&b); a=n; b%=9973; for(int i=0;;i++) { a+=9973; if(a%b==0)break; } printf("%d\n",(a/b)%9973); } return 0... 阅读全文

posted @ 2013-05-20 21:39 雨钝风轻 阅读(118) 评论(0) 推荐(0) 编辑

hdu 1319 Prime Cuts

摘要: #include<stdio.h>#include<string.h>#include<vector>#include<algorithm>using namespace std;const int N=1010;bool visit[N];vector<int>prime;int init_prim(){ memset(visit,true,sizeof(visit)); int num=0; prime.push_back(1); for(int i=2; i<=N; i++) { if(visit[i]==true) { 阅读全文

posted @ 2013-05-20 20:56 雨钝风轻 阅读(241) 评论(0) 推荐(0) 编辑

hdu 1262 寻找素数对(STL)

摘要: #include<stdio.h>#include<string.h>#include<vector>#include<algorithm>using namespace std;vector<int>prime;vector<int>::iterator it1,it;const int N=10100;bool visit[N];//int prime[N];int num=0;int init_prim(){ memset(visit,true,sizeof(visit)); prime.push_back(0); 阅读全文

posted @ 2013-05-20 19:41 雨钝风轻 阅读(214) 评论(0) 推荐(0) 编辑

hdu 1163 Eddy's digital Roots

摘要: #include<stdio.h>int cal(int m){ while(m>9) { //int yu=m; int sum=0; for(int i=0;m;i++) { sum+=m%10; m/=10; } m=sum; } return m;}int main(){ int n; while(scanf("%d",&n)!=EOF&&n!=0) { int mul=1; for(int... 阅读全文

posted @ 2013-05-20 17:46 雨钝风轻 阅读(149) 评论(0) 推荐(0) 编辑

2013年5月19日 #

快速幂

摘要: http://ch.vijos.org/Contest/%E8%BE%BD%E5%AE%81%E7%9C%81%E9%98%9F%E4%BA%92%E6%B5%8B%20Weak%201/Problem/Show/%E5%BF%AB%E9%80%9F%E5%B9%82#include<stdio.h>#include<string>#include<iostream>using namespace std;string s;int mod;long long multy(long long q, long long n){ long long cnt = n 阅读全文

posted @ 2013-05-19 19:16 雨钝风轻 阅读(203) 评论(0) 推荐(0) 编辑

C - Count The Carries(南洋理工OJ)

摘要: C - Count The Carries时间限制:3000 Ms内存限制:65535 Kb问题描述One day, Implus gets interested in binary addition and binary carry. He will transfer all decimal digits to binary digits to make the addition. Not as clever as Gauss, to make the addition from a to b, he will add them one by one f... 阅读全文

posted @ 2013-05-19 13:03 雨钝风轻 阅读(421) 评论(0) 推荐(0) 编辑

2013年5月18日 #

hdu 4545 魔法串

摘要: #include<stdio.h>#include<string.h>#include<map>using namespace std;char a[1010];char b[1010];//map<char,char>m;char c[2020];//multimap<char,char>::iterator it;int main(){ int _case,n; char x,y; int al,bl,i,j,ij; scanf("%d",&_case); for(ij=1;ij<=_case;i 阅读全文

posted @ 2013-05-18 16:46 雨钝风轻 阅读(240) 评论(0) 推荐(0) 编辑

hdu 4548 美素数

摘要: #include<stdio.h>#include<string.h>#include<math.h>const int n=1000100;bool visit[n];int prime[n];int ans[70000];int a[60];//下标所对应的值不为素数,置0int js;int isprime(){ //int N; for(int i=0; i<60; i++) a[i]=i;//初始化自然序列 a[1]=0;//1不为素数 for(int i=2; i<=sqrt(60+0.5); i++) { //对任一不超过... 阅读全文

posted @ 2013-05-18 16:43 雨钝风轻 阅读(300) 评论(0) 推荐(0) 编辑

HDU2554 N对数的排列

摘要: 转:http://blog.csdn.net/lulipeng_cpp/article/details/7661207#reply这题可以这样来抽象: n对数,大小为1、2、3、...、n。现要求两个1之间有1个数,两个2之间有2个数,以此类推,两个n之间有n个数。 并且,数的次序可以随意的。解决之道: 准备知识: ①n对数,共2*n个数。所以要有2*n个位置来放置这2*n个数。②sum()表示求和运算。 正式解决: ①设k(k=1,2,..,n)放置的第一个位置为ak,第二个位置为bk(两个相同的k)。显然有bk-ak=k+1(假定下一个位置在上一个位置之前)。 ... 阅读全文

posted @ 2013-05-18 11:05 雨钝风轻 阅读(736) 评论(0) 推荐(0) 编辑

上一页 1 ··· 45 46 47 48 49 50 51 52 53 ··· 59 下一页