#include <stdio.h> #define DEF #define #define RI _ri(); #define RL _rl(); #define RS(x) scanf(" %s",x) #define WI(x) printf("%d\n",x) #define WL(x) printf("%lld\n",x) #define WS(x) puts(x) #define FOR(x,y) for(x = 0; x < y; x++) static inline int _ri() { int r, i = scanf(" %d",&r); (void)i; return r; } static inline int _rl() { long long r, i = scanf(" %lld",&r); (void)i; return r; } int main() { int i, n = RI; FOR(i,n) { int v = RI; int z = 0; while (v > 1) { if (v&1) printf("(1+"), z++; printf("(1+1)*"); v>>=1; } putchar('1'); while (z--) putchar(')'); putchar('\n'); } }
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 | #include <stdio.h> #define DEF #define #define RI _ri(); #define RL _rl(); #define RS(x) scanf(" %s",x) #define WI(x) printf("%d\n",x) #define WL(x) printf("%lld\n",x) #define WS(x) puts(x) #define FOR(x,y) for(x = 0; x < y; x++) static inline int _ri() { int r, i = scanf(" %d",&r); (void)i; return r; } static inline int _rl() { long long r, i = scanf(" %lld",&r); (void)i; return r; } int main() { int i, n = RI; FOR(i,n) { int v = RI; int z = 0; while (v > 1) { if (v&1) printf("(1+"), z++; printf("(1+1)*"); v>>=1; } putchar('1'); while (z--) putchar(')'); putchar('\n'); } } |