#include <iostream>
using namespace std;
int t;
long long we;
void odp(long long k)
{
int otw=0;
string ret;
for(int i=k; i>0; i/=2)
{
if(i%2==0)
{
ret+="((1+1)*";
otw++;
}
else
{
if(i==1)
ret+="1";
else
{
ret+="(1+(1+1)*";
otw++;
}
}
}
for(int i=0; i<otw; i++) ret+=")";
ret+="\n";
cout<<ret;
}
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
cin>>t;
for(int i=0; i<t; i++)
{
cin>>we;
odp(we);
}
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #include <iostream> using namespace std; int t; long long we; void odp(long long k) { int otw=0; string ret; for(int i=k; i>0; i/=2) { if(i%2==0) { ret+="((1+1)*"; otw++; } else { if(i==1) ret+="1"; else { ret+="(1+(1+1)*"; otw++; } } } for(int i=0; i<otw; i++) ret+=")"; ret+="\n"; cout<<ret; } int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin>>t; for(int i=0; i<t; i++) { cin>>we; odp(we); } return 0; } |
English