#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
const char *dwojka="(1+1)";
int main()
{
    int t;
    cin >> t;
    for(int i=0; i < t; ++i)
    {
        unsigned int k, nawiasy=0, ile_krokow=0;
        cin >> k;
        //k=i+1; //do debugowania
        if(k==1)
        {
            cout << '1';
        }
        while(k > 1)
        {
            ++ile_krokow;
            if(k%2)
            {
                ++nawiasy;
                cout << "(1+";
                --k;
            }
            else
            {
                ++ile_krokow;
                cout << dwojka;
                if(k/2!=1){cout << '*';}
                k/=2;
            }
        }
        cout << string(nawiasy,')') /*<< ": " << ile_krokow*/ << '\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 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include <iostream> #include <string> #include <cstdlib> using namespace std; const char *dwojka="(1+1)"; int main() { int t; cin >> t; for(int i=0; i < t; ++i) { unsigned int k, nawiasy=0, ile_krokow=0; cin >> k; //k=i+1; //do debugowania if(k==1) { cout << '1'; } while(k > 1) { ++ile_krokow; if(k%2) { ++nawiasy; cout << "(1+"; --k; } else { ++ile_krokow; cout << dwojka; if(k/2!=1){cout << '*';} k/=2; } } cout << string(nawiasy,')') /*<< ": " << ile_krokow*/ << '\n'; } } | 
 
            
         English
                    English