| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 140112 | 李朋秦 | 十进制小数转二进制 | C++ | Wrong Answer | 0 MS | 268 KB | 408 | 2025-12-13 15:35:36 |
#include<bits/stdc++.h> using namespace std; int main(){ double a; int x[101]={},b=0,y[101]={}; cin>>a; int i=0; if(a==0)cout<<0; b=a; while(b!=0){ x[i]=b%2; b/=2; i++; }for(int j=i-1;j>=0;j--)cout<<x[j]; double c=a-b; if(c!=0){ cout<<"."; c*=2; cout<<int(c)-6; c=c-(int(c)); while(c!=0){ c*=2; cout<<int(c); c=c-(int(c)); } } return 0; }
------Input------
98.69140625
------Answer-----
1100010.10110001
------Your output-----
1100010.1910110001