hiho week 157 register

Ended

Participants:182

Verdict:Accepted
Score:100 / 100
Submitted:2017-07-07 17:54:28

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <string>
using namespace std;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    for(;n--;) {
        string x;
        cin >> x;
        int y = x.length();
        for(int j = y-1; j >= 0; j--) {
            if(x[j]!='0') break;
            y--;
        }
        for(int j = 2; j < y; j++) x[j] -= '0';
        string z = "";
        for(int j = 2; j < y; j++) {
            for(int i = 2; i < y; i++) {
                x[i] *= 2;
            }
            for(int i = y-1; i > 2; i--) {
                x[i-1] += x[i] / 10;
                x[i]   %= 10;
            }
            if(x[2] >= 10) {
                z += '1';
                x[2] -= 10;
            } else {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX