#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; } }
关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。
技术网站地址: vmfor.com