Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
1001题:我的代码不知道出啥问题了<请指教>#include<stdio.h> #include<string.h> int main() { char a[10][128],z; int b[10][64],c[10][100],i=0,n[10],m[10],j,k,t; scanf("%d",&n[0]); if(n[0]!=0) { z=getchar(); gets(a[0]); } while(n[i]!=0) { i++; scanf("%d",&n[i]); if(n[i]!=0) { z=getchar(); gets(a[i]); } } for(j=0;j<i;j++) { t=0; for(k=0;a[j][k]!='\0';k++) { if(a[j][k]>='0'&&a[j][k]<='9') { b[j][t]=a[j][k]-48; t++; } } b[j][t]=0; } for(j=0;j<i;j++) { n[j]=0; m[j]=b[j][0]; for(k=0;b[j][k]!=0;k++) { if(b[j][k]>m[j]) m[j]=b[j][k]; n[j]=n[j]+b[j][k]; } } for(j=0;j<i;j++) { t=0; for(k=1;k<n[j];k++) { if(n[j]%k==0) { c[j][t]=k; t++; } } c[j][t]=0; } for(j=0;j<i;j++) for(k=0;c[j][k]!=0;k++) if(c[j][k]>=m[j]) { printf("%d\n",c[j][k]); break; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator