noi 八进制小数

 1 #include <cmath>
 2 #include <cstdio>
 3 #include <cstring>
 4 double n2=0;
 5 char n1[20];
 6 int main()
 7 {
 8     scanf("%s",n1);
 9     int nl=strlen(n1);
10     for(int i=2; i<nl; i++)
11         n2+=(n1[i]-'0')*1.0/pow(8,double(i-1));
12     printf("%s [8] = %.50g [10]",n1,n2);
13     return 0;
14 }

原题链接:http://www.noi.openjudge.cn/ch0113/03/

原文地址:https://www.cnblogs.com/tp25959/p/10233777.html