Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
138482 冯诚阳 十进制小数转二进制 C++ Wrong Answer 0 MS 268 KB 468 2025-11-24 20:21:14

Tests(1/10):


Code:

#include <iostream> using namespace std; int main(){ double n; cin>>n; int a=n; double b=n-a; int x[64]={},w=0; while(a!=0){ x[w]=a%2; w++; a/=2; } for(int i=w-1;i>=0;i--) cout<<x[i]; if(b!=0) cout<<'.'; while(b!=0){ b*=2; if(b>=1){ cout<<1; b-=1; } else{ cout<<0; } } return 0; }


Run Info:

------Input------
0
------Answer-----
0
------Your output-----