Ankit_132

D

Dec 6th, 2023
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define _test   int _TEST; cin>>_TEST; while(_TEST--)
  7.  
  8. int main()
  9. {
  10.     _test
  11.     {
  12.         int n;
  13.         cin>>n;
  14.  
  15.         int tmp=1;
  16.         int p=0;
  17.         while(tmp<=n)
  18.         {   p++;
  19.             tmp*=2;
  20.         }
  21.        
  22.         if((1<<(p-1))==n)
  23.         {
  24.             cout<<-1<<'\n';
  25.             continue;
  26.         }
  27.        
  28.         tmp=n;
  29.         p=0;
  30.         while(tmp%2==0)
  31.         {   p++;
  32.             tmp=tmp/2;
  33.         }
  34.        
  35.         cout<<tmp/2*(1<<p)<<" "<<(1<<p)<<" "<<(1<<p)<<'\n';
  36.     }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment