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 |
看着烦就直接强扒了#include<stdio.h> main() { long a; int n; scanf("%d",&n); while(n--) { scanf("%ld",&a); if(a<10) printf("%ld\n",a); else if(a<100) { if(a%10>4) printf("%ld\n",(a/10+1)*10); else printf("%ld\n",a/10*10); } else if(a<1000) { if(a%100>44) printf("%ld\n",(a/100+1)*100); else printf("%ld\n",a/100*100); } else if(a<10000) { if(a%1000>444) printf("%ld\n",(a/1000+1)*1000); else printf("ld\n",a/1000*1000); } else if(a<100000) { if(a%10000>4444) printf("%ld\n",(a/10000+1)*10000); else printf("%ld\n",a/10000*10000); } else if(a<1000000) { if(a%100000>44444) printf("%ld\n",(a/100000+1)*100000); else printf("%ld\n",a/100000*100000); } else if(a<10000000) { if(a%1000000>444444) printf("%ld\n",(a/1000000+1)*1000000); else printf("%ld\n",a/1000000*1000000); } else { if(a%10000000>4444444) printf("%ld\n",(a/10000000+1)*10000000); else printf("%ld\n",a/10000000*10000000); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator