Run ID:75415

提交时间:2024-05-26 17:34:33

#include<bits/stdc++.h> using namespace std; int main(){ double n; cin >> n; int z = n; double x = n - z; int b[32],cnt = 0; while(z != 0){ int yu = z%2; b[cnt] = yu; cnt++; z/=2; } if(cnt == 0){ cout << "0"; }else{ for(int i = cnt-1;i >=0;i--){ cout<<b[i]; } } if(x != 0){ cout <<"."; }else{ return 0; } for(int i = 0;i < 9;i--){ x = x * 2; int xz = x; cout<<xz; x = x - xz; if(x == 0){ break; } } return 0; }