| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 162646 | 李沐阳 | 二进制小数转十进制 | C++ | Accepted | 1 MS | 276 KB | 305 | 2026-10-18 09:58:19 |
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int l=s.size(),i=0; double q=1,shi=0; while(s[i]!='.') i++; for(int k=i-1;k>=0;k--){ shi+=(s[k]-'0')*q; q*=2; } q=2; for(i+=1;i<l;i++){ shi+=(s[i]-'0')/q; q*=2; } cout<<shi<<endl; return 0; }