#include <iostream> #include <cmath> #include <string> using namespace std; int main() { //freopen("acm.acm","r",stdin); int num; int i; int j; int tem; int index; int sum; string s; cin>>num; getchar(); while(num --) { index = 0; getline(cin,s); for(i = 0; i < 4; ++ i) { sum = 0; for(j = index; j < 8+index; ++ j) { tem = s[j] - ‘0‘; if(tem == 1) sum += pow(double(2),index+8-j-1)*tem; } index += 8; if(i != 3) cout<<sum<<"."; else cout<<sum; // cout<<" index "<<index<<endl; } cout<<endl; } }
时间: 2024-10-13 12:34:22