2011年4月28日

统计元音

摘要: #include<stdio.h>#include<string.h>int main( ){ int N; scanf("%d",&N); getchar(); while(N--) { char ch[300]; gets(ch); int i,j,len,a=0,e=0,t=0,o=0,u=0; len=strlen(ch); for(i=0;i<len;i++) if(ch[i]=='a') a++; else if(ch[i]=='e') e++; else if(ch[i]=='i&# 阅读全文

posted @ 2011-04-28 20:10 more think, more gains 阅读(143) 评论(0) 推荐(0) 编辑

首字母变大写

摘要: #include<stdio.h>#include<string.h>int main( ){ char ch[120]; while(gets(ch)) { int i,j,len; len=strlen(ch); for(i=0;i<len;i++) if(ch[i-1]==' '&&i!=0&&ch[i]!=' ') ch[i]=ch[i]-32; if(ch[0]!=' ') ch[0]=ch[0]-32; printf("%s\n",ch);}return 阅读全文

posted @ 2011-04-28 20:01 more think, more gains 阅读(153) 评论(0) 推荐(0) 编辑

查找最大元素

摘要: #include<stdio.h>#include<string.h>int main( ){ char ch[120],max; while(gets(ch)) { int i,j,len; len=strlen(ch); max=ch[0]; for(i=1;i<len;i++) if(ch[i]>max) max=ch[i]; for(i=0;i<len;i++) { printf("%c",ch[i]); if(ch[i]==max) printf("(max)");}puts("") 阅读全文

posted @ 2011-04-28 19:34 more think, more gains 阅读(136) 评论(0) 推荐(0) 编辑

合法标志符

摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>int fun(char a[ ]){ int i,t; t=strlen(a); if(a[0]>='0'&&a[0]<='9') return 0; else if(!((a[0]>='A'&&a[0]<='Z')||(a[0]>='a'&&a[0]<='z')||a[0] 阅读全文

posted @ 2011-04-28 19:23 more think, more gains 阅读(955) 评论(0) 推荐(0) 编辑

求平均成绩

摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>int main( ){ int N,M,i,j,k; float A[60][10],sum[60],B[60]; while(scanf("%d%d",&N,&M)!=EOF) { int num=0;k=0; memset(A,0,sizeof(A)); memset(B,0,sizeof(B)); memset(sum,0,sizeof(sum)); for(i=0;i<N;i++) for(j=0;j& 阅读全文

posted @ 2011-04-28 18:32 more think, more gains 阅读(158) 评论(0) 推荐(0) 编辑

海选女主角

摘要: #include<stdio.h>#include<math.h>int A[1000][1000];int main( ){ int N,M,i,j,k,max,p; while(scanf("%d%d",&N,&M)!=EOF) { for(i=1;i<=N;i++) for(j=1;j<=M;j++) scanf("%d",&A[i][j]); max=fabs(A[1][1]); k=1,p=1; for(i=1;i<=N;i++) for(j=1;j<=M;j++) if( 阅读全文

posted @ 2011-04-28 17:41 more think, more gains 阅读(155) 评论(0) 推荐(0) 编辑

发工资咯:

摘要: #include<stdio.h>int num=0;void fun(int x){ num+=x/100; x=x%100; num+=x/50; x=x%50; num+=x/10; x=x%10; num+=x/5; x=x%5; num+=x/2; x=x%2; num+=x/1;}int main( ){ int N,i,t; while(scanf("%d",&N)!=EOF,N) { for(i=1;i<=N;i++) { scanf("%d",&t); fun(t); } printf("%d 阅读全文

posted @ 2011-04-28 17:25 more think, more gains 阅读(157) 评论(0) 推荐(0) 编辑

绝对值排序

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>#include<math.h>int cmp(const void *a,const void *b){ return abs(*(int *)a)< abs(*(int *)b)?1:-1;}int main( ){ int N,A[10000]; while(scanf("%d",&N)... 阅读全文

posted @ 2011-04-28 16:58 more think, more gains 阅读(180) 评论(0) 推荐(0) 编辑

数列有序!

摘要: #include<stdio.h>int A[10000];int main( ){ int N,M,i,j,k; while(scanf("%d%d",&N,&M),N||M) { for(i=0;i<N;i++) scanf("%d",&A[i]); for(i=0;i<N;i++) if(M<=A[i]) { for(j=N-1;j>=i;j--) A[j+1]=A[j]; A[i]=M; ... 阅读全文

posted @ 2011-04-28 16:36 more think, more gains 阅读(127) 评论(0) 推荐(0) 编辑

母牛的故事

摘要: #include<stdio.h>int fun(int x){ if(x==1) return 1; else if(x==2) return 2; else if(x==3) return 3; else return fun(x-1)+fun(x-3);}int main( ){ int N; while(scanf("%d",&N)!=EOF,N) printf("%d\n",fun(N)); return 0;} 阅读全文

posted @ 2011-04-28 16:17 more think, more gains 阅读(151) 评论(0) 推荐(0) 编辑

字符串统计

摘要: #include<stdio.h>#include<string.h>int main( ){ int N; char ch[200]; scanf("%d",&N); while(N--) { int n=0,i; scanf("%s",ch); for(i=0;ch[i]!='\0';i++) if(ch[i]>='0'&&ch[i]<='9') n++; printf("%d\n",n);}return 0;} 阅读全文

posted @ 2011-04-28 16:12 more think, more gains 阅读(126) 评论(0) 推荐(0) 编辑

数据的交换输出

摘要: #include<stdio.h>void swap(int &x,int &y){ int temp; temp=x; x=y; y=temp;}int main( ){ int N,A[10000],i,j,min; while(scanf("%d",&N),N) { for(i=0;i<N;i++) scanf("%d",&A[i]); min=A[0]; j=0; for(i=1;i<N;i++) if(A[i]<min) { min=A[i]; j=i; } swap(A[0],A[ 阅读全文

posted @ 2011-04-28 16:06 more think, more gains 阅读(160) 评论(0) 推荐(0) 编辑

偶数求和

摘要: #include<stdio.h>int main(){ int N,i,j,k,M; while(scanf("%d%d",&N,&M)!=EOF) { int sum=0,k=0,flag=1; for(i=2;i<=2*N;i=i+2) { sum+=i; k++; if(k==M) printf(flag?"%d":" %d",sum/M),sum=0,k=0,flag=0; else if(i==2*N&&k!=M) printf(flag?"%d":&q 阅读全文

posted @ 2011-04-28 15:59 more think, more gains 阅读(148) 评论(0) 推荐(0) 编辑

还是打分那个,我不用函数啦。。。。。。竟然0ms…

摘要: #include<stdio.h>int main( ){ int N,i,A[110],j,k; while(scanf("%d",&N)!=EOF) { double sum=0,min,max; for(i=0;i<N;i++) scanf("%d",&A[i]); max=min=A[0]; j=k=0; for(i=1;i<N;i++) if(A[i]<min) { min=A[i]; j=i; } else if(A[i]>max) { max=A[i]; k=i; } A[j]=0; A[ 阅读全文

posted @ 2011-04-28 15:37 more think, more gains 阅读(156) 评论(0) 推荐(0) 编辑

青年歌手大奖赛_评委会打分

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>int cmp(const void *a,const void *b){ return *(double * )a > *(double *)b ? 1: -1;}int main( ){ int N; while(scanf("%d",&N)!=EOF) { double sum=0; double A[10000]; int i; memset(A,0,sizeof(A)); for(i=0;i<N;i++) 阅读全文

posted @ 2011-04-28 15:22 more think, more gains 阅读(185) 评论(0) 推荐(0) 编辑

蟠桃记

摘要: #include<stdio.h>int fun(int x){ int sum=1,i; for(i=x;i>1;i--) sum=2*sum+2; return sum;}int main( ){ int N; while(scanf("%d",&N)!=EOF) printf("%d\n",fun(N)); return 0;} 阅读全文

posted @ 2011-04-28 14:57 more think, more gains 阅读(153) 评论(0) 推荐(0) 编辑

素数判定

摘要: #include<stdio.h>#include<math.h>int prime(int n){ int i; for(i=2;i<=sqrt(n);i++) { if(n%i==0) return 0; else if(i>sqrt(n)) return 1; }}int main( ){ int x,y,i; while(scanf("%d%d",&x,&y),x||y) { for(i=... 阅读全文

posted @ 2011-04-28 14:27 more think, more gains 阅读(134) 评论(0) 推荐(0) 编辑

多项式求和

摘要: #include<stdio.h>#include<math.h>int main( ){ int N,i,j,k,t; float p; scanf("%d",&N); for(i=1;i<=N;i++) { scanf("%d",&t); double sum=0;k=1,p=1; for(j=1;k<=t;k++) { sum+=j/p; p++; j=-j; } printf("%.2lf\n",sum); } return 0; }整除时注意,不能都是int型 阅读全文

posted @ 2011-04-28 14:15 more think, more gains 阅读(148) 评论(0) 推荐(0) 编辑

水仙花数

摘要: #include<stdio.h>int main( ){ int N,M; while(scanf("%d%d",&N,&M)!=EOF) { int i,j,k,X,flag=1; for(X=N;X<=M;X++) { i=X/100; j=X/10-i*10; k=X-100*i-10*j; if(i*i*i+j*j*j+k*k*k==X) printf(flag?"%d":" %d",X),flag=0; if(X==M&&!flag) puts(""); 阅读全文

posted @ 2011-04-28 13:56 more think, more gains 阅读(123) 评论(0) 推荐(0) 编辑

求数列的和

摘要: #include<stdio.h>#include<math.h>int main( ){ int N,M,i; while(scanf("%d%d",&N,&M)!=EOF) { double sum=0,p=N; for(i=0;i<M;i++) sum+=p,p=sqrt(p); printf("%.2lf\n",sum); } return 0;} 阅读全文

posted @ 2011-04-28 12:32 more think, more gains 阅读(121) 评论(0) 推荐(0) 编辑

导航