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<cstdio> #include<cstring> char c[50]; int i,l; double x,y; int main() { while(scanf("%s",c)!=EOF){ printf("%s [8] = ",c); l=strlen(c)-1; x=0;y=1; for(i=l;i>1;i--){ x=((c[i]-'0')*y+x)*125; y*=1000; } x/=y; i=0; while(x){c[i]=int(x*=10)%10+'0';x-=c[i]-'0';i++;} c[i]='\0'; printf("0.%s [10]\n",c); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator