Run ID:69248

提交时间:2024-03-31 12:09:03

#include <bits/stdc++.h> using namespace std; int main (){ string a; cin>>a; int d=a.find("."); int b=a.size(); double n=0,w=0; for(int i=d-1;i>=0;i--){ n+=(a[i]-'0')*pow(2,w); w++; } w=-1; for(int i=d+1;i<b;i++){ n+=(a[i]-'0')*pow(2,w); w--; } cout<<n; return 0; }