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的数据!本地测试都是正确的,为什么WA! #include<stdio.h> long mi(int a,int n) { int i; long sum=1; if(n==0) sum=1; else { for (i=0;i<n;i++) sum=sum*a; } return sum; } void main() { int n,i,j,k,m; long num; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%ld",&num); for(j=8;j>0;j--) { if(num>mi(10,j)) break; } m=0; for(k=0;k<10&&m!=1;k++) { if(num<k*mi(10,j)) { m=1; break; } } if(num<10) num=num; else if(num>((k-1)*mi(10,j)+4*mi(10,j-1))) num=(k)*mi(10,j); else num=(k-1)*mi(10,j); printf("%ld\n",num); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator