Facebook
From Mustard Penguin, 2 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 95
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6. using namespace std;
  7.  
  8. void twosetbits(unsigned long n)
  9.     {
  10.     long start=1;
  11.     long end=0;
  12.     while(n>0){
  13.         while(start>end){
  14.             if(n==1){
  15.                 unsigned long res=((1<<start)|(1<<end));
  16.                 cout<<res<<endl;
  17.             }
  18.             end++;
  19.             n--;
  20.         }
  21.         start++;
  22.         end=0;
  23.     }
  24.  
  25. }
  26.  
  27. int main() {
  28.     int n;
  29.     cin>>n;
  30.     unsigned long a;
  31.     for(int i=0;i<n;i++){
  32.         cin>>a;
  33.         twosetbits(a);
  34.     }
  35.     return 0;
  36. }
  37.