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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <bits/stdc++.h>
#define pb push_back

using namespace std;

int t, k;

int main()
{
    scanf("%d", &t);

    while(t--)
    {
        scanf("%d", &k);

        if(k == 1)
        {
            printf("1\n");
            continue;
        }

        vector<int> bin;

        while(k > 0)
        {
            bin.pb(k % 2);

            k /= 2;
        }

        string sol = "";

        for(int i = bin.size() - 2; i >= 0; --i)
        {
            if(i < bin.size() - 2)
                sol += "*";

            sol += "(1+1)";

            if(bin[i] == 1)
            {
                sol += "+1";

                if(i != 0)
                    sol = "(" + sol + ")";
            }
        }

        cout << sol << endl;
    }

    return 0;
}