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 |
why my submission is always wrong anwser?高手们 指点一下迷津吧 跪求! #include<iostream> using namespace std; int main() { char a[1000]; double di=8; long double sum=0; for(int wo=0;wo<=6;++wo){ cin>>a; if(a[0]-'0'==1) {cout<<'1'<<' '<<"[8]"<<' '<<'='<<' '<<"1"<<' '<<"[10]"<<endl;sum=0;di=8;continue;} for(int i=2;a[i];++i) { sum+=1.0*(a[i]-'0')/di; di*=8.0; }if(a[0]-'0'==0&&a[1]=='\0') {cout<<'0'<<' '<<"[8]"<<' '<<'='<<' '<<"0"<<' '<<"[10]"<<endl;sum=0;di=8;continue;} cout<<a<<' '<<"[8]"<<' '<<'='<<' '<<"0."; for( i=0;sum>=1e-8;++i) { sum*=10; cout<<int(sum); sum-=int(sum); }cout<<' '<<"[10]"<<endl;sum=0;di=8;} return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator