Problem:
金剛の型
以下のように、右から 7 ビット分が小数部、続く24 ビット分が整数部で、一番左の 1 ビット分を符号部とする 32 ビット実数型を考える(b
1
, ... , b
32
は 0 か1 を表す）。
この形式を、人が理解しやすい 10 進数表現に直すときは、以下のように解釈する。
(-1)
符号部
× (整数部 + 小数部)
上の表現で、整数部の値は b
8
＋ 2
1
×b
9
＋ 2
2
×b
10
＋ ... ＋ 2
23
×b
31
になる。例えば整数部が
のようになっていた場合、整数部の値は以下のように計算される。
1 +  2
1
+ 2
3
= 1 + 2 + 8 =  11
一方、小数部の値は(0.5)
1
×b
7
＋(0.5)
2
×b
6
＋ ... ＋ (0.5)
7
× b
1
になる。例えば小数部が
のようになっていた場合、小数部は以下のように計算される。
0.5
1
+ 0.5
3
= 0.5 + 0.125 = 0.625
さらに、符号部、整数部、小数部を合わせた以下のようなビット列の場合、
ビット列全体が表す10 進数は、以下のようになる(ただし、-1 の0 乗は1)。
(-1)
0
× (1 + 2 + 8 + 0.5 + 0.125) = 1 × (11.625) = 11.625
32 ビットのビット列を Q 個入力すると、それらのビット列が表す実数の10 進表記を一切の誤差無く出
力するプログラムを作成してください。
入力
入力は１つのデータセットからなる。入力データは以下の形式で与えられる。
Q
s
1
s
2
.
.
.
s
Q
1 行目にビット列の数 Q (1 ≤ Q ≤ 10000)が与えられる。続くQ 行に入力ビット列 s
i
が与えられる。 入力ビット列は 16 進数表記で与えられるとする (例: 0111 1111 1000 1000 0000 0000 0000 0000 は 7f880000 と与えられる) 。つまり、Q 行のそれぞれには、2 進数を 4 ビット分ずつまとめた 16 進数が 8 個、空白をはさまずに並んでいる。10 進数、2 進数、16 進数の対応は以下の表のとおりである。
16 進数の英字 a から f までは小文字で与えられる。
出力
各ビット列が表す実数の 10 進表記を 1 行ずつ出力する。ただし、小数部において、ある桁以下がすべて 0 の場合、その桁以下は省略するものとするが、例外として小数部が 0 の場合は小数部には 0 ひとつを出力する。
入力例
8
00000000
80000000
00000080
00000040
000000c0
00000100
80000780
80000f70
出力例
0.0
-0.0
1.0
0.5
1.5
2.0
-15.0
-30.875

Submitted solutions:

code_snippet: #include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int Q;
    cin >> Q;
    while(Q--) {
        string s;
        cin >> s;
        int n = 0;
        for(int i=0; i<8; ++i) {
            n <<= 4;
            if(isdigit(s[i])) {
                n += s[i] - '0';
            } else {
                n += s[i] - 'a' + 10;
            }
        }
        double res = 0;
        double d = 1;
        {
            int t = n & ((1LL << 31) - 1);
            res += (t >> 7);
        }
        int cnt = 1;
        for(int i=6; i>=0; --i) {
            d /= 2;
            if(n & (1 << i)) {
                res += d;
                cnt = 6 - i + 1;
            }
        }
        cout << fixed << setprecision(cnt);
        if(n & (1 << 31)) {
            cout << -res << endl;
        } else {
            cout << res << endl;
        }
    }
}
accuracy: 1
time_ms: 10
memory_kb: 3608
final_rank: 11

code_snippet: #include<bits/stdc++.h>

using namespace std;

double Value;
string HexInput, BinaryInput;

const string ConvertTable[16] = {
	"0000","0001","0010","0011",
	"0100","0101","0110","0111",
	"1000","1001","1010","1011",
	"1100","1101","1110","1111",
};


void changeToBinary() {
	int index;

	BinaryInput = "";
	for (int i = 0; i < 8; ++i) {
		switch (HexInput[i]) {
			case 'a':index = 10; break;
			case 'b':index = 11; break;
			case 'c':index = 12; break;
			case 'd':index = 13; break;
			case 'e':index = 14; break;
			case 'f':index = 15; break;
			default :index = HexInput[i] - '0'; break;
		}
		BinaryInput += ConvertTable[index];
	}
	reverse(BinaryInput.begin(), BinaryInput.end());
	//cout << "outBinary:" << BinaryInput << endl;
}

void solve() {
	int countOfFraction;
	
	Value = 0;
	countOfFraction = 1;
	for (int i = 0; i < 7; ++i) {
		if (BinaryInput[6-i] != '0') {
			Value += pow(0.5, i + 1);
			countOfFraction = i + 1;
		}
	}
	//cout << Value << " : cnt=" << countOfFraction << endl;

	for (int i = 7; i < 31; ++i) {
		if (BinaryInput[i] != '0') {
			Value += pow(2, i-7);
		}
	}
	if (BinaryInput[31] == '1') {
		cout << "-";
	}
	cout << fixed << setprecision(countOfFraction) << Value << endl;
}

int main() {
	int n;

	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> HexInput;
		changeToBinary();
		solve();
	}
	
	return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3420
final_rank: 18

code_snippet: #include <iostream>
#include <iomanip>
#include <sstream>

using namespace std;

int main() {

    int q;
    cin >> q;

    while ( q-- ) {

	unsigned int b;
	cin >> hex >> b;

	double res = (b&0x7fffffff) >> 7;//整数部の値で初期化
	
	//小数部を加算
	double frac = 0.5;
	for ( int i=6; i>=0; --i ) {
	    if ( (b>>i)&1 ) res += frac;
	    frac *= 0.5;
	}

	//フォーマット
	stringstream ss;
	ss << setprecision(15) << fixed << res;
	string s = ss.str();
	for ( int i=s.size()-1; i>0; --i ) {
	    if ( s[i] != '0' ) {
		s.erase( i+1, s.size() );
		break;
	    }
	}
	     
	cout << ((b>>31)?"-":"") << s << ((b&0x0000007f)?"":"0") << endl;
    }

    return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3272
final_rank: 17

code_snippet: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll s;
    cin >> hex >> s;
    
    if((s>>31)&1) cout << "-";
    
    ll Kassa1 = (s & 0x7FFFFFFF) >> 7; // 整数部分
    ll Kassa2 = (s & 0x0000007F); // 小数部分
    
    double ans = Kassa1;
    
    int saisyouno_keta = 0;
    for(int i = 0; i < 7;i++){
        if((Kassa2 >> (6-i))&1){
            ans += pow(0.5,i+1);
            saisyouno_keta = i;
        }
    }
    
    cout << fixed << setprecision(saisyouno_keta+1) << ans << endl;
    return ans;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    
    int Q; cin >> Q;
    while(Q--){
        solve(0);
        // cout << fixed << setprecision(15) << solve<double>() << endl;
    }
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3416
final_rank: 10

code_snippet: #include <bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
	int n; cin >> n;
	while(n--){
		string s;
		cin >> s;
		vector<int> bit;

		for(int i = 0;i < 8;i++){
			int b;
			if(s[i] < 'a'){
				b = s[i] - '0';
			}else{
				b = s[i] - 'a' + 10;
			}
		
			stack<int> st;
			for(int j = 0;j < 4;j++){
				st.push(b % 2);
				b /= 2;
			}
			while(!st.empty()){
				bit.push_back(st.top());
				st.pop();
			}
		}
		
		reverse(bit.begin(), bit.end());
		
		
		double ans = 0;
		double ans2 =0;
		double tmp = 0.5;
		for(int i = 6;i >= 0;i--){
			if(bit[i]){
				ans += tmp;
			}
			tmp /= 2;
		}
		
		int ansnum = 0;
		int ttmp = 1;
		for(int i = 7;i < 31;i++){
			if(bit[i]) ansnum += ttmp;
			ttmp *= 2;
		}
		
		ans2 = ans;
		ans += ansnum;
		if(bit[31] == 1){
			cout << '-';
		}
		cout << ansnum;
		cout << ".";
		do{
			int tmp = ans2 * 10;
			cout << tmp;
			ans2 *= 10;
			ans2 -= tmp;
		}while(ans2 != 0);
		cout << endl;
			
	}
	return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3180
final_rank: 13

code_snippet: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <stdio.h>

using namespace std;

int main() {

	int q;
	cin >> q;
	vector<string> s(q);
	for (int i = 0; i < q; i++) cin >> s[i];

	// 16進数
	vector<double> ans(q, 0.0);

	vector<vector<int>> beg(q, vector<int>(32, 0));

	// 2進数に直す？
	for (int i = 0; i < q; i++) {
		//cout << i << endl;
		for (int j = 7; j >= 0; j--) {
			int value;

			switch (s[i][j]) { // めちゃきたない
			case 'a':
				value = 10;
				break;
			case 'b':
				value = 11;
				break;
			case 'c':
				value = 12;
				break;
			case 'd':
				value = 13;
				break;
			case 'e':
				value = 14;
				break;
			case 'f':
				value = 15;
				break;
			default:
				value = s[i][j] - '0';
				break;
			}
			//cout << value << endl;

			int tmp = 8;
			for (int k = 0; k < 4; k++) {
				if (value >= tmp) {
					beg[i][(7 - j) * 4 + 3 - k] = 1;
					value -= tmp;
				}
				tmp /= 2;
			}
		}
	}

	/*
	for (int i = 0; i < q; i++) {
		for (int j = 0; j < 32; j++) {
			if (j % 4 == 0) cout << " ";
			cout << beg[i][31 - j];
		}
		cout << endl;
	}*/

	vector<bool> syou(q, false);

	// こっから計算
	for (int i = 0; i < q; i++) {
		double cnt = 1.0;
		for (int j = 7; j >= 0; j--) {
			// 小数点の計算
			if (beg[i][j] == 1) {
				ans[i] += cnt;
				if(j != 7)
					syou[i] = true;
			}
			cnt *= 0.5;
		}

		cnt = 2.0;
		for (int j = 8; j < 31; j++) {
			// 整数の計算
			if (beg[i][j] == 1) {
				ans[i] += cnt;
			}
			cnt *= 2.0;
		}

		// 最後に符号
		if (beg[i][31] == 1)
			ans[i] *= -1.0;
	}

	// .0が必要
	for (int i = 0; i < q; i++) {
		if (beg[i][0] == 1) printf("%.7lf\n", ans[i]);
		else if (beg[i][1] == 1) printf("%.6lf\n", ans[i]);
		else if (beg[i][2] == 1) printf("%.5lf\n", ans[i]);
		else if (beg[i][3] == 1) printf("%.4lf\n", ans[i]);
		else if (beg[i][4] == 1) printf("%.3lf\n", ans[i]);
		else if (beg[i][5] == 1) printf("%.2lf\n", ans[i]);
		else printf("%.1lf\n", ans[i]);
	}

	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 5176
final_rank: 19

code_snippet: #include <bits/stdc++.h>
using namespace std;

string calc(char s){
    if(s == '0') return "0000";
    if(s == '1') return "0001";
    if(s == '2') return "0010";
    if(s == '3') return "0011";
    if(s == '4') return "0100";
    if(s == '5') return "0101";
    if(s == '6') return "0110";
    if(s == '7') return "0111";
    if(s == '8') return "1000";
    if(s == '9') return "1001";
    if(s == 'a') return "1010";
    if(s == 'b') return "1011";
    if(s == 'c') return "1100";
    if(s == 'd') return "1101";
    if(s == 'e') return "1110";
    if(s == 'f') return "1111";
}

int main(){
    int q; cin>>q;
    while(q--){
        string s; cin>>s;
        string t = "";
        for(int i=0; i<8; i++){
            t += calc(s[i]);
        }

        int ans1 = 0;
        int num1 = (1 << 23);
        for(int i=1; i<=24; i++){
            ans1 += (t[i] == '1') * num1;
            num1 /= 2;
        }

        double ans2 = 0.0;
        double num2 = 0.5;
        for(int i=25; i<=31; i++){
            ans2 += (t[i] == '1') * num2;
            num2 /= 2;
        }

        if(t[0] == '1') cout << "-";
        if(ans2 == 0.0){
            cout << ans1 << ".0" << endl;
        }
        else{
            double ans3 = 1. * ans1 + ans2;
            printf("%.20g\n", ans3);
        }
    }
}
accuracy: 1
time_ms: 10
memory_kb: 3284
final_rank: 7

code_snippet: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

string f(char c){
    if(c == '0') return "0000";
    if(c == '1') return "0001";
    if(c == '2') return "0010";
    if(c == '3') return "0011";
    if(c == '4') return "0100";
    if(c == '5') return "0101";
    if(c == '6') return "0110";
    if(c == '7') return "0111";
    if(c == '8') return "1000";
    if(c == '9') return "1001";
    if(c == 'a') return "1010";
    if(c == 'b') return "1011";
    if(c == 'c') return "1100";
    if(c == 'd') return "1101";
    if(c == 'e') return "1110";
    if(c == 'f') return "1111";
    return "error";
}

int hgoe(int huga){
    if(huga == 0) return 5000000;
    if(huga == 1) return 2500000;
    if(huga == 2) return 1250000;
    if(huga == 3) return  625000;
    if(huga == 4) return  312500;
    if(huga == 5) return  156250;
    if(huga == 6) return   78125;
}

string g1(char c){
    if(c == '1') return "-";
    else return "";
}

string g2(string s){
    reverse(s.begin(), s.end());
    double mul = 1;
    int ret = 0;
    for(int i = 0; i < (int)s.size(); i++){
        ret += mul * (s[i] == '1');
        mul *= 2;
    }
    
    
    return to_string(ret);
}

string g3(string s){
    int ret = 0;
    for(int i = 0; i < (int)s.size(); i++){
        ret += hgoe(i) * (s[i] == '1');
    }

    string str = to_string(ret);
    while(str.size() != 7) str = "0" + str;

    while(str.size() != 1){
        if(str.back() == '0') str.pop_back();
        else break;
    }
    return str;
}

signed main(){
    
    int n; cin >> n;
    for(int i_ = 0; i_ < n; i_++){
        string s; cin >> s;
        string bin;
        for(int i = 0; i < 8; i++){
            bin = bin + f(s[i]);
        }
        cout << g1(bin[0]) << g2(bin.substr(1, 24)) << "." << g3(bin.substr(25, 7)) << endl;
    }
    
    

    return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3236
final_rank: 15

code_snippet: #include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; ++i)
using ll = long long;

void solve(){
    string s;
    cin>>s;
    ll cur = 0;
    rep(i,s.size()){
        cur*=16;
        if('0'<=s[i]&&s[i]<='9')cur+=s[i]-'0';
        else cur+=s[i]-'a'+10;
    }
    bool sgn = false;
    if(cur>=1ll<<31){
        cur-=1ll<<31;
        sgn = true;
    }
    rep(i,7)cur*=5;
    if(sgn)cout<<"-";
    cout<<cur/10000000;
    cout<<".";
    string ans = "";
    bool ok = false;
    rep(i,7){
        if(cur%10!=0||ok){
            ans = (char)(cur%10+'0')+ans;
            ok=true;
        }
        cur/=10;
    }
    if(ans=="")ans="0";
    cout<<ans<<endl;
}

int main(){
    int n;
    cin>>n;
    while(n--)solve();
}
accuracy: 1
time_ms: 10
memory_kb: 3204
final_rank: 3

code_snippet: #include <iostream>
#include <bitset>
#include <cmath>
#include <iomanip>
using namespace std;
string syodu(int s){
  int ret = 78125*s;
  while(ret % 10 == 0)ret/=10;
  string zero;
  if(s == 1)zero = "00";
  else if(s <= 12)zero = "0";
  return zero+to_string(ret);
}
int main(){
  int q;cin>>q;
  for(int i = 0; q > i; i++){
    long long ans = 0;
    int syosu = 0;
    bool seihu = true;
    char b[8];for(int j = 0; 8 > j; j++)cin>>b[j];
    for(int j = 0; 8 > j; j++){
      bitset<4>tm = b[j];
      if(b[j] >= 'a'){
        tm = 10+(b[j]-'a');
      }
      if(tm[3]){
        if (j == 0) {
          seihu = false;
        }else if(j <= 6){
          ans += pow(2,(6-j)*4);
        }else{
          syosu+=8;
        }
      }
      if(tm[2]){
        if(j <= 5){
          ans += pow(2,((5-j)*4+3));
        }else{
          if(j == 6)syosu+=64;
          if(j == 7)syosu+=4;
        }
      }
      if(tm[1]){
        if(j <= 5){
          ans += pow(2,((5-j)*4+2));
        }else{
          if(j == 6)syosu += 32;
          if(j == 7)syosu += 2;
        }
      }
      if(tm[0]){
        if(j <= 5){
          ans += pow(2,((5-j)*4+1));
        }else{
          if(j == 6)syosu += 16;
          if(j == 7)syosu += 1;
        }
      }
      
    }
    if(!seihu)cout << '-';
    if(syosu == 0){
      cout << fixed << ans << ".0" << endl;
    }else{
      cout << fixed << ans << "." << syodu(syosu)  << endl;
    }
  }
}
accuracy: 1
time_ms: 10
memory_kb: 3408
final_rank: 9

code_snippet: // includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);

  map<char, int> mp;

  for(int i = 0; i < 10; i++) mp['0' + i] = i;
  for(int i = 0; i < 6; i++) mp['a' + i] = 10 + i;

  int q;
  cin >> q;

  cout << showpoint;
  for(int i = 0; i < q; i++) {
    string s;
    cin >> s;
    signed x = 0;
    int sgn = 1;
    for(int j = 0; j < 8; j++) {
      int v = mp[s[j]];
      if(j == 0 && (v & 8)) {
        v ^= 8;
        sgn = -1;
      }
      x += v << ((7 - j) * 4);
    }
    double ans = sgn * (double(x) / (1 << 7));
    stringstream ss;
    // ss << showpoint;
    ss << fixed << setprecision(10);
    ss << ans;
    string g;
    ss >> g;
    while(g[g.size()-1] == '0' && g[g.size()-2] != '.') g.pop_back();
    cout << g << "\n";
  }

  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3264
final_rank: 5

code_snippet: #include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	int q;

	cin >> q;

	for (int i = 0; i < q; i++) {
		long long s;
		long double t;

		cin >> hex >> s;

		if (s > 0x80000000 - 1)
			cout << "-";

		s %= 0x80000000;
		t = s;
		t /= 128;

		if (s % 128 != 0)
			cout << setprecision(20) << t << endl;
		else
			cout << t << ".0" << endl;			
	}

	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3252
final_rank: 4

code_snippet: #include<iostream>
#include<algorithm>
#include<iostream>
using namespace std;

int hextodec(char c){
    if(c <= '9')    return c-'0';
    return 10 + c-'a';
}

string dec(char x){
    int num = hextodec(x);
    string res = "";
    for(int i = 0; i < 4; i++){
        if(num & (1<<i))    res += "1";
        else                res += "0";
    }
    reverse(res.begin(), res.end());
    return res;
}


int main(){
    int bias[32] = {};
    for(int i = 1; i < 25; i++){
        bias[i] = 1<<(24-i);
    }
    bias[25] = 5000000;
    for(int i = 26; i < 32; i++){
        bias[i] = bias[i-1]/2;
    }

    int q;
    cin >> q;
    
    string s;

    while(q-- > 0){
        cin >> s;
        string bin = "";
        for(char c : s) bin += dec(c);
        int a = 0, b = 0;
        for(int i = 1; i < 25; i++){
            if(bin[i] == '1')   a += bias[i];
        }
        for(int i = 25; i < 32; i++){
            if(bin[i] == '1')   b += bias[i];
        }

        string sb = to_string(b);
        while(sb.length() != 7) sb = "0" + sb;
        while(sb.length() > 0 && sb[sb.length()-1] == '0')  sb = sb.substr(0, sb.length()-1);
        if(sb == "")    sb = "0";
        
        if(bin[0] == '1')   cout << "-";
        cout << a << "." << sb << endl;
    }

    return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3224
final_rank: 14

code_snippet: #include<iostream>
#include<ios>
using namespace std;
int n;
int f(char c)
{
	if(c<='9')return c-'0';
	else return c-'a'+10;
}
main()
{
	cin>>n;
	for(;n--;)
	{
		string s;cin>>s;
		bool hugou=0;
		int d;
		double a;
		hugou=f(s[0])/8;
		d=f(s[0])%8;
		for(int i=1;i<=5;i++)
		{
			d=d*16+f(s[i]);
		}
		d=d*2+f(s[6])/8;
		a=f(s[6])%8*16+f(s[7]);
		if(hugou)cout<<'-';
		if(a==0)cout<<d<<".0";
		else printf("%.15g",d+a/128);
		cout<<endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 3288
final_rank: 8

code_snippet: #include <cstdio>
#include <math.h>

int Q;
unsigned int bit;
char ch[9];
double ans;

unsigned cnv(char c){
	if(c >= '0' && c <= '9'){
		return c - '0';
	}
	else{
		return (c - 'a') + 10;
	}
}

int main(){
	scanf("%d",&Q);
	for(int I = 0; I < Q; I++){
		scanf("%s",ch);
		bit = 0;
		ans = 0;
		for(int i = 0; i < 8; i++){
			unsigned k = cnv(ch[i]);
			bit |= (k << (4*(7-i)));
		}
		for(int i = 0; i < 31; i++){
			if(bit & (1<<i)){
				ans += pow(2,i-7);
			}
		}
		if(bit & (1<<31)){
			printf("-");
		}
		if(bit & ((1<<7)-1)){
			char msg[8] = "%.1f\n";
			for(int i = 0; i < 7; i++){
				if(bit & (1<<i)){
					msg[2] = '0' + (7-i);
					printf(msg,ans);
					break;
				}
			}

		}
		else{
			printf("%.1f\n",ans);
		}
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 2856
final_rank: 1

code_snippet: #include <bits/stdc++.h>

using namespace std;

int etot(char a) {
    if(a >= 'a') {
        return a - 'a' + 10;
    } else {
        return a - '0';
    }
}

int main() {
    
    int q;
    string s;

    cin >> q;

    for(int k = 0; k < q; ++k) {

        cin >> s;

        unsigned int b = 0;
        for(int i = 0; i < 8; ++i) {
            b |= etot(s[7 - i]) << 4 * i;
        }

        if(b >> 31 & 1) cout << "-";

        cout << ((b >> 7) & ((1 << 24) - 1));

        int under_point = 0;
        int w = 78125;
        for(int i = 0; i < 7; ++i) {
            if((b >> i) & 1) {
                under_point += w;
            }
            w *= 2;
        }

        cout << ".";

        if(under_point) {
            int d = 7;
            while(!(under_point % 10)) {
                under_point /= 10;
                --d;
            }
            printf("%0*d\n", d, under_point);
        } else {
            cout << "0" << endl;
        }

    }

}
accuracy: 1
time_ms: 10
memory_kb: 3264
final_rank: 5

code_snippet: #include <iostream>
#include <string>
using namespace std;

string to_bit(string s){
	string ret = "";
	for(int i = 0;i < 8;i++){
		int t;
		if(s[i] <= '9' && s[i] >= '0') t = s[i] - '0';
		else t = s[i] - 'a' + 10;
		for(int j = 0;j < 4;j++){
			if(t >> (3 - j) & 1) ret += to_string(1);
			else ret += to_string(0);
		}
	}
	return ret;
}

int main(){
	int q;
	cin >> q;
	for(int i = 0;i < q;i++){
		long double ans = 0.0;
		string s;
		cin >> s;
		s = to_bit(s);
		if(s[0] == '1') cout << "-";
		for(int j = 1;j < 25;j++){
			ans *= 2.0;
			if(s[j] == '1') ans += 1.0;
		}
		long double add = 0.5;
		for(int j = 25;j < 32;j++){
			if(s[j] == '1') ans += add;
			add /= 2.0;
		}
		cout << (int)ans << ".";
		do{
			ans -= (int)ans;
			ans *= 10.0;
			cout << (int)ans;
		}while((ans - (int)ans) > 1e-9);
		cout << endl;
	}
	return 0;
}
accuracy: 1
time_ms: 40
memory_kb: 3264
final_rank: 20

code_snippet: #include<bits/stdc++.h>
using namespace std;
int main()
{
  int Q;
  cin >> Q;
  while( Q-- ) {
    string s = "";
    for(int i=0; i<8; i++) {
      char c;
      cin >> c;
      if( c == '0' ) s += "0000";
      if( c == '1' ) s += "0001";
      if( c == '2' ) s += "0010";
      if( c == '3' ) s += "0011";
      if( c == '4' ) s += "0100";
      if( c == '5' ) s += "0101";
      if( c == '6' ) s += "0110";
      if( c == '7' ) s += "0111";
      if( c == '8' ) s += "1000";
      if( c == '9' ) s += "1001";
      if( c == 'a' ) s += "1010";
      if( c == 'b' ) s += "1011";
      if( c == 'c' ) s += "1100";
      if( c == 'd' ) s += "1101";
      if( c == 'e' ) s += "1110";
      if( c == 'f' ) s += "1111";
      // cout << s << endl;
    } 
 
    long long int sum = 0;
    long double sum2 = 0;
    for(int i=24; i>0; i--) {
      if( s[i] == '1' ) {
    sum += pow(2.0, 24-i);
      }
    }
    for(int i=25; i<32; i++) {
      if( s[i] == '1' ) {
    sum2 += pow(0.5, i-25+1);
      }
    }
    
    long long int tmp = (long long int)sum2;
    if( sum2 - (long double)tmp > 0 ) {
      if( s[0] == '1' ) {
    cout << '-';
      }
      string add = "";
      while( 1 ) {
    if( sum2 == 0 ) break;
    sum2 *= 10;
    tmp = (long long int)sum2;
    add += '0' + tmp;
    sum2 -= (long double)tmp;
      }
     
      cout << sum << '.' << add << endl;
    } else {
      if( s[0] == '1' ) {
    cout << '-';
      }
      cout << sum << ".0" << endl; 
    }
  }
   
}
accuracy: 1
time_ms: 10
memory_kb: 3156
final_rank: 2

code_snippet: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  while(n--){
    int o=0;
    double d=0.0,w=2147483648.0;
    for(int i=0;i<8;i++)w/=2;
    string s;
    cin>>s;
    for(int i=0;i<8;i++){
      int p;
      if(s[i]>='0'&&s[i]<='9')p=s[i]-'0';
      else p=s[i]-'a'+10;
      int ss[4]={};
      for(int j=3;j>=0;j--)ss[j]=(p>>j)&1;
      for(int j=3;j>=0;j--){//cout<<w<<endl;
	if(!i&&j==3){if(ss[j])o++;}
	else{
	  if(ss[j])d+=w;
	  w/=2.0;
	  if(w==0)w=0.5;//cout<<w<<endl;
	}
      }
    }
    if(o)cout<<'-';
    if(d-(long int)d){
      printf("%.99g\n",d);
    }
    else{
      printf("%ld",(long int)d);cout<<".0"<<endl;
    }
   }
}
accuracy: 1
time_ms: 20
memory_kb: 3256
final_rank: 16

code_snippet: #include<bits/stdc++.h>
using namespace std;
int main()
{
  int Q;
  cin >> Q;
  while( Q-- ) {
    string s = "";
    for(int i=0; i<8; i++) {
      char c;
      cin >> c;
      if( c == '0' ) s += "0000";
      if( c == '1' ) s += "0001";
      if( c == '2' ) s += "0010";
      if( c == '3' ) s += "0011";
      if( c == '4' ) s += "0100";
      if( c == '5' ) s += "0101";
      if( c == '6' ) s += "0110";
      if( c == '7' ) s += "0111";
      if( c == '8' ) s += "1000";
      if( c == '9' ) s += "1001";
      if( c == 'a' ) s += "1010";
      if( c == 'b' ) s += "1011";
      if( c == 'c' ) s += "1100";
      if( c == 'd' ) s += "1101";
      if( c == 'e' ) s += "1110";
      if( c == 'f' ) s += "1111";
      // cout << s << endl;
    } 

    long long int sum = 0;
    long double sum2 = 0;
    for(int i=24; i>0; i--) {
      if( s[i] == '1' ) {
	sum += pow(2.0, 24-i);
      }
    }
    for(int i=25; i<32; i++) {
      if( s[i] == '1' ) {
	sum2 += pow(0.5, i-25+1);
      }
    }
   
    long long int tmp = (long long int)sum2;
    if( sum2 - (long double)tmp > 0 ) {
      if( s[0] == '1' ) {
	cout << '-';
      }
      string add = "";
      while( 1 ) {
	if( sum2 == 0 ) break;
	sum2 *= 10;
	tmp = (long long int)sum2;
	add += '0' + tmp;
	sum2 -= (long double)tmp;
      }
	
      cout << sum << '.' << add << endl;
    } else {
      if( s[0] == '1' ) {
	cout << '-';
      }
      cout << sum << ".0" << endl; 
    }
  }
  
}
accuracy: 1
time_ms: 20
memory_kb: 3176
final_rank: 12