Run ID:108205
提交时间:2025-01-19 15:22:51
#include<bits/stdc++.h> using namespace std; int a[33]; long long t ; long long i = 0; int main() { double x,y = x -t ; cin>>x; if(t==0){ cout<<0; } while(t != 0) { a[i] = t % 2; t = t/2; i++; } for(int j = i - 1; j >= 0; j--) { cout<<a[j]; } if(y != 0) { cout<<'.'; while(y != 0) { y = y * 2; cout<<(int)y; y = y - ((int)y); } } cout<<endl; return 0; }