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
#include <cstdio>
#include <cstdint>

int main() {
    uint32_t n, k;
    scanf("%d", &n);
    for (uint32_t i = 0; i < n; ++i){
        scanf("%d", &k);
        uint32_t open_braces = 0;
        if (k == 1){
            printf("1\n");
            continue;
        }
        while(true){
            if (k % 2 == 1){
                printf("1+");
                k--;
            }
            printf("(1+1)");
            k /= 2;
            if (k > 2) {
                printf("*(");
                open_braces++;
            }
            else if (k == 2) {
                printf("*(1+1)");
                break;
            }
            else {
                break;
            }
        };
        for (int j = 0; j < open_braces; ++j){
            printf(")");
        }
        printf("\n");
    }
    return 0;
}