Run ID:147493
提交时间:2026-02-05 16:00:27
#include <iostream> #include<vector> using namespace std; int main() { double c; cin>>c; int t = c; double d = c - t; int a[64]; 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(d!=0) cout<<'.'; while(d != 0){ d = d * 2; if(d>=1){ cout<<1; d-=1; } else cout<<0; } return 0; }