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<iostream> #include<string.h> #include<math.h> using namespace std; int main() { char a[9]; int n=0,l=0,sum=0,k=0; cin>>n; for(int i=0;i<n;i++) { cin>>a; l=strlen(a); if((a[1]-'0')<4)k=a[0]-'0'; if((a[1]-'0')>4)k=(a[0]-'0')+1; if(a[1]-'0'==4) { if(l==2)k=a[0]-'0'; for(int m=2;m<l;m++) { if((a[m]-'0')!=0) { k=a[0]-'0'+1; break; } else k=a[0]-'0'; } } sum=k*pow(10.0,l-1); cout<<sum<<endl; sum=0; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator