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 |
实在WA得受不了了,烦劳大家看看问题才哪里,测试数据都对的#include<stdio.h> #include<string.h> #include<math.h> main() { char a[20]; int i,j,k,l,n; long total,sum1,sum2; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%s",a); l=strlen(a); k=l-1; sum1=0; sum2=1; total=0; if(l==1) printf("%d\n",a[0]-48); else { for(j=1;j<=k;j++) { sum1=sum1+(a[j]-48)*pow(10,k-j); sum2=sum2+4*pow(10,k-j); if(sum1>=sum2) a[0]=a[0]+1; } total=total+(a[0]-48)*pow(10,l-1); printf("%ld\n",total); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator