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 |
为什么我的while循环没用,要泪崩了!!!1#include<stdio.h> #include<string.h> int main() { int n,m,j,k; char a[10]; scanf("%d",&n); while(n--) { scanf("%s",&a); m=strlen(a); if(m==1) { printf("%s\n",a); continue; } else { 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; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator