上一页 1 ··· 7 8 9 10 11 12 13 下一页

2012年8月8日

nyoj517 最小公倍数

摘要: 1 //我的代码: 2 #include<stdio.h> 3 #include<string.h> 4 #define N 50 5 int len,a[N]={1}; 6 char tab[100][45]={0,1}; 7 inline int gcd(int a,int b) 8 { 9 return b==0?a:gcd(b,a%b);10 }11 int mod(int t) //求余12 {13 int i,k;14 for(k=0,i=len-1;i>=0;--i){15 k=(k*10+a[i])%t;16 }17 ... 阅读全文

posted @ 2012-08-08 11:59 小花熊 阅读(359) 评论(0) 推荐(0) 编辑

2012年8月7日

poj1686 Lazy Math Instructor

摘要: 1 #include<map> 2 #include<stack> 3 #include<cctype> 4 #include<iostream> 5 using namespace std; 6 map<char,int> m; //从字符映射到数字 7 string s1,s2,r1,r2; 8 string transform(string s)//把表达式转化为后缀表达式方便计算 9 {10 int i,j,len;11 char c[81];12 stack<char> exp; //定义一个字符栈,存放运算符 阅读全文

posted @ 2012-08-07 21:32 小花熊 阅读(604) 评论(1) 推荐(1) 编辑

poj1028 Web Navigation

摘要: Accepted360K16MSG++700B 1 #include<stdio.h> 2 #include<string.h> 3 char fs[100][71],bs[100][71]; 4 int ftop,btop; 5 int main() 6 { 7 char a[8],cur[71]; 8 strcpy(cur,"http://www.acm.org/"); 9 while(scanf("%s",a),strcmp(a,"QUIT")){10 if(!strcmp(a,"VISIT&q 阅读全文

posted @ 2012-08-07 16:23 小花熊 阅读(188) 评论(0) 推荐(0) 编辑

poj1250 Tanning Salon

摘要: 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 char c,p[26]; 6 int n,curnum,leave; 7 while(scanf("%d%*c",&n),n) 8 { 9 curnum=leave=0;10 memset(p,0,sizeof(p));11 for(c=getchar();c!='\n';c=getchar()){12 if(p[c-'A']==1){13 ... 阅读全文

posted @ 2012-08-07 11:25 小花熊 阅读(211) 评论(0) 推荐(0) 编辑

poj2082 Terrible Sets

摘要: 1 #include<stdio.h> 2 struct Node{ //定义堆栈 3 int w,h; //w为目前为止整个区域的宽度,h为当前矩形的高度 4 }stack[50001]; 5 int main() 6 { 7 int i,n,top,totalw; //top为栈顶指针,totalw为总的宽度 8 int curw,curh,maxsize; //curw,curh为新矩形高度,宽度。maxsize为当前最大矩形面积 9 while(scanf("%d",&n),n+1)10 {11 for(totalw=... 阅读全文

posted @ 2012-08-07 10:11 小花熊 阅读(409) 评论(0) 推荐(0) 编辑

2012年8月6日

poj2359 Questions

摘要: 1 #include<stdio.h> 2 #include<string.h> 3 char s[30001],str[30001]; 4 int main() 5 { 6 int i,k,len; 7 while(gets(str)) 8 strcat(s,str); 9 len=strlen(s);10 for(k=0,i=2;i<=len;++i)11 k=(k+1999)%i;12 if(s[k]=='?') printf("Yes\n");13 else if(s[k]==' ') printf(&q 阅读全文

posted @ 2012-08-06 18:34 小花熊 阅读(182) 评论(0) 推荐(0) 编辑

poj3250 Bad Hair Day

摘要: 1 //超时代码 2 #include<stdio.h> 3 unsigned ans; 4 int main() 5 { 6 int i,j,n,Q[80000]; 7 scanf("%d",&n); 8 for(i=0;i<n;++i) 9 scanf("%d",&Q[i]);10 for(i=n-1;i>=0;--i){ //从后往前读 11 for(j=i+1;j<n&&Q[i]>Q[j];++j); //从i处往后查找,直到碰到大于等于它的数为止 12 ans+=j-i-1; 阅读全文

posted @ 2012-08-06 18:00 小花熊 阅读(261) 评论(1) 推荐(1) 编辑

hdu1053 Entropy

摘要: 1 #include<iostream> 2 #include<iomanip> 3 #define N 27 4 using namespace std; 5 int cmp(const void *a,const void *b) 6 { 7 return *(int *)b-*(int *)a; //从大到小排序,方便对最小次小值的 操作 8 } 9 int main()10 {11 string s;12 int num[27],a[27];13 int i,j,wpl,len;14 while(cin>>s,s!="END"){ 阅读全文

posted @ 2012-08-06 09:18 小花熊 阅读(574) 评论(0) 推荐(0) 编辑

2012年8月3日

poj1936 All in All

摘要: 1 #include<stdio.h> 2 char str[100001],sub[100001]; 3 int main() 4 { 5 int i,k; 6 while(~scanf("%s%s",sub,str)) 7 { 8 for(k=i=0;str[i];i++) 9 if(str[i]==sub[k]&&sub[k])10 k++;11 if(sub[k]) printf("No\n");12 else printf("Yes\n");13 ... 阅读全文

posted @ 2012-08-03 23:50 小花熊 阅读(150) 评论(0) 推荐(0) 编辑

poj1047 Round and Round We Go

摘要: 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 char s[65],b[65],str[60][65]; 6 int i,k,t,c,len; 7 bool flag; 8 while(~scanf("%s",s)){ 9 len=strlen(s);10 for(i=0;i<len;++i){11 strcpy(str[i],s+i);12 strncat(str[i],s,i);13 }1... 阅读全文

posted @ 2012-08-03 23:02 小花熊 阅读(157) 评论(0) 推荐(0) 编辑

上一页 1 ··· 7 8 9 10 11 12 13 下一页

导航