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
#include<iostream>
using namespace std;

string dec_to_bin(int number){
    string result = "";
    do{
        if((number & 1) == 0) result += "0";
        else result += "1";
        number >>= 1;
    } while(number);
    return result;
}

int main(){
    ios_base::sync_with_stdio(0);
    int t;
    cin >> t;
    while(t--){
        int k;
        cin >> k;
        if(k == 1){
            cout << "1\n";
            continue;
        }
        string k_bin=dec_to_bin(k);
        string answer = "";
        for(int i=0; i<k_bin.size()-2; i++){
            if(k_bin[i] == '1') answer+="1+";
            answer+="(1+1)*(";
        }
        if(k_bin[k_bin.size()-2] == '1') answer+="1+";
        answer+="1+1";
        for(int i=0; i<k_bin.size()-2; i++) answer+=")";
        cout << answer << "\n";
    }
}