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 |
我用字符数组做的··代码绝不算多 yeah!#include<iostream> using namespace std; double tmp,input,ans; int main() { int n; char a[100]; scanf("%d",&n); while(n--){ scanf("%s",&a); for (int i=strlen(a) - 2;i>=0;--i) if (a[i+1] >= '5') { a[i+1] = '0'; a[i] ++; } else a[i+1] = '0'; if (a[0] > '9') { a[0] = '0'; printf("1"); } printf("%s\n",a); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator