| ||||||||||
| 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 | |||||||||
Re:why waIn Reply To:why wa Posted by:042395 at 2006-11-18 17:08:24 > #include<stdio.h>
> #include<string.h>
> int main()
> {
> int n,i,m,j,k;
> char a[16];
> scanf("%d",&n);
> for(i=0;i<n;i++)
> {scanf("%s",&a);
> m=strlen(a);
> if(m==1)
> { printf("%s\n",a);
> continue;
> }
> for(k=m-1;k>=0;k--)
> {
> if(a[k]>='5')
> a[k-1]++;
> }
> if(a[0]>'9')
> { a[0]='0';
> printf("1");}
> for(j=1;j<m;j++)
> { a[j]='0';}
> printf("%s\n",a);
> }
> return 0;
> }
>
输入149结果是200吧
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator