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 |
我用c写的,为什么老是runtime error????????!!!高手帮忙看看,谢谢!!!#include"stdio.h" #include"string.h" main() { int i,k,j,h,n,sum=0,add,lose,array[4]={0,9,3,7}; char a[1000][8]; scanf("%d",&n); for(i=1;i<=n;i++) scanf("%s",a[i]); for(i=1;i<=n;i++) { for(k=1,j=strlen(a[i])-1;j>=0;k++,j--) { if(k==4)k=1; if(a[i][j]!='?') sum+=(a[i][j]-48)*array[k]; else {add=k;lose=j;} } for(h=9;h>=0;h--) { if((h*array[add]+sum)==((h*array[add]+sum)/10*10)) break; } a[i][lose]=h+48; sum=0; } for(i=1;i<=n;i++) { if(i!=n) printf("Scenario #%d:\n%s\n\n",i,a[i]); else printf("Scenario #%d:\n%s\n",i,a[i]); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator