#include <limits.h> #include <iostream> #include <math.h> #include <bitset> using namespace std; // Convert the 32-bit binary encoding into hexadecimal int Binary2Hex( std::string Binary ) { std::bitset<32> set(Binary); int hex = set.to_ulong(); return hex; } // Convert the 32-bit binary into the decimal float GetFloat32( std::string Binary ) { int HexNumber = Binary2Hex( Binary ); bool negative = !!(HexNumber & 0x80000000); int exponent = (HexNumber & 0x7f800000) >> 23; int sign = negative ? -1 : 1; // Subtract 127 from the exponent exponent -= 127; // Convert the mantissa into decimal using the // last 23 bits int power = -1; float total = 0.0; for ( int i = 0; i < 23; i++ ) { int c = Binary[ i + 9 ] - '0'; total += (float) c * (float) pow( 2.0, power ); power--; } total += 1.0; float value = sign * (float) pow( 2.0, exponent ) * total; return value; } int main() { string s; for(int i=0; i<102; i++) {\ cin >> s; float f = GetFloat32( s ); std::cout << f << std::endl; } return 0; }
01000000100000000000000000000000 01000000100000100000000000000000 01000000100000010000000000000000 01000000100000110000000000000000 01000000100000100000000000000000 01000001000011100000000000000000 01000001000011100000000000000000 01000001000011100000000000000000 01000001000011000000000000000000 01000000111101000000000000000000 01000000111110000000000000000000 01000000111110110000000000000000 01000001000010100000000000000000 01000000111110100000000000000000 01000000111111000000000000000000 01000000111100100000000000000000 01000000111101000000000000000000 01000000111011000000000000000000 01000000111001100000000000000000 01000000111001010000000000000000 01000000111000000000000000000000 01000000111010010000000000000000 01000000100111000000000000000000 01000000111001010000000000000000 01000000111001010000000000000000 01000000110100100000000000000000 01000000110100110000000000000000 01000000110100010000000000000000 01000000110100010000000000000000 01000000101111110000000000000000 01000000110001000000000000000000 01000000110101000000000000000000 01000000110010100000000000000000 01000000110010010000000000000000 01000000101000010000000000000000 01000000100110010000000000000000 01000000011100110000000000000000 01000000011011010000000000000000 01000000011011100000000000000000 01000000011011010000000000000000 01000000011011100000000000000000 01000000011011010000000000000000 01000000011110000000000000000000 01000000001111100000000000000000 01000000000101100000000000000000 01000000000110000000000000000000 01000000000011010000000000000000 00111111111110001000000000000000 00111111111100111000000000000000 01000000000110100000000000000000 01000000000111000000000000000000 01000000100111100000000000000000 01000000101010000000000000000000 01000000100100110000000000000000 01000000100001100000000000000000 01000000101110010000000000000000 01000000101010100000000000000000 01000000101010100000000000000000 01000000101010010000000000000000 01000000100110010000000000000000 01000000100110010000000000000000 01000000100110000000000000000000 01000000100110000000000000000000 01000000100101110000000000000000 01000000101100000000000000000000 01000000101101010000000000000000 01000000101100110000000000000000 01000000101011110000000000000000 01000000101011010000000000000000 01000000101011000000000000000000 01000000101011000000000000000000 01000000101010110000000000000000 01000000100010110000000000000000 01000000101101010000000000000000 01000000101101000000000000000000 01000000101100010000000000000000 01000000101011110000000000000000 01000000101100000000000000000000 01000000011010100000000000000000 01000000011101100000000000000000 01000000110011010000000000000000 01000000101110100000000000000000 01000000101110110000000000000000 01000000101101110000000000000000 01000000101100000000000000000000 01000000101001110000000000000000 01000000101001110000000000000000 01000000011111000000000000000000 01000000100001010000000000000000 01000000001000010000000000000000 01000000000010100000000000000000 01000000000001100000000000000000 01000000000010000000000000000000 01000000001001000000000000000000 01000000001101100000000000000000 01000000100000100000000000000000 01000000100000100000000000000000 01000000101001100000000000000000 01000000101100100000000000000000 01000000010010000000000000000000 01000000011010100000000000000000
4 4.0625 4.03125 4.09375 4.0625 8.875 8.875 8.875 8.75 7.625 7.75 7.84375 8.625 7.8125 7.875 7.5625 7.625 7.375 7.1875 7.15625 7 7.28125 4.875 7.15625 7.15625 6.5625 6.59375 6.53125 6.53125 5.96875 6.125 6.625 6.3125 6.28125 5.03125 4.78125 3.79688 3.70312 3.71875 3.70312 3.71875 3.70312 3.875 2.96875 2.34375 2.375 2.20312 1.94141 1.90234 2.40625 2.4375 4.9375 5.25 4.59375 4.1875 5.78125 5.3125 5.3125 5.28125 4.78125 4.78125 4.75 4.75 4.71875 5.5 5.65625 5.59375 5.46875 5.40625 5.375 5.375 5.34375 4.34375 5.65625 5.625 5.53125 5.46875 5.5 3.65625 3.84375 6.40625 5.8125 5.84375 5.71875 5.5 5.21875 5.21875 3.9375 4.15625 2.51562 2.15625 2.09375 2.125 2.5625 2.84375 4.0625 4.0625 5.1875 5.5625 3.125 3.65625 3.65625