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
#include <iostream>
#include <string>

std::string findRepr (int n)
{
    if (n == 1)
        return std::string("1");
    if (n == 2)
        return std::string("1+1");
    std::string res;
    if (n % 2)
    {
        res = "1+(";
        res += findRepr (n - 1);
        res += ")";
    }
    else
    {
        res = "(1+1)*(";
        res += findRepr (n/2);
        res += ")";
    }
    return res;
}

int main ()
{
    std::ios_base::sync_with_stdio(0);
    int T;
    std::cin >> T;
    while (T --)
    {
        int n;
        std::cin >> n;
        std::cout << findRepr (n) << '\n';
    }
}