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 <bits/stdc++.h>
using namespace std;

int main()
{
	int cases;
	scanf("%d",&cases);
	
	while(cases--)
	{
		int n;
		bool g = false;
		scanf("%d",&n);
		int k = 1;
		int nawiasy = 0;

		while(n > 0)
		{
			g = false;
			if(k & n)
			{
				n -= k;
				if(n > 0)printf("("),nawiasy++;
				printf("1");
				g = true;
			}
			if(n > 0)
			{
				if(g)printf("+");
				printf("(1+1)*");
			}
			k *= 2;
		}
		while(nawiasy--)printf(")");
		puts("");
	}
}