#include <cstdio>
int main() {
int t; scanf("%d", &t);
while (t --> 0) {
unsigned n;
scanf("%u", &n);
int b=0;
while (n) {
if (n==1)
printf("1");
else if (n&1)
printf("(1+(1+1)*");
else
printf("((1+1)*");
b++;
n/=2;
}
while (b --> 1)
printf(")");
printf("\n");
}
return 0;
}
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 | #include <cstdio> int main() { int t; scanf("%d", &t); while (t --> 0) { unsigned n; scanf("%u", &n); int b=0; while (n) { if (n==1) printf("1"); else if (n&1) printf("(1+(1+1)*"); else printf("((1+1)*"); b++; n/=2; } while (b --> 1) printf(")"); printf("\n"); } return 0; } |
English