| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 147476 | 谢绍澜 | 十进制小数转二进制 | C++ | Output Limit Exceeded | 0 MS | 268 KB | 571 | 2026-02-05 14:49:48 |
#include <iostream> using namespace std; int main() { double x; cin>>x; int t = x; double y = x - t; int a[33] = {}; int i = 0; if(t==0) cout<<0; while(t != 0){ a[i] = t % 2; t /= 2; i++; } for(int j = i - 1;j >= 0;j--){ cout<<a[j]; } if(y != 0){ cout<<'.'; while(y != 0){ y = y * 2; if(y==1){ cout<<1; return 0; } else if(y>1) cout<<1; else cout<<0; } } }