Advertisement
sidjha57

double_xor

Jul 9th, 2022
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.99 KB | None | 0 0
  1. //Siddharth Jha
  2.  
  3. #include<bits/stdc++.h>
  4. //#include<ext/pb_ds/assoc_container.hpp>
  5. //#include<ext/pb_ds/tree_policy.hpp>
  6. //#include <ext/pb_ds/trie_policy.hpp>
  7. //using namespace __gnu_pbds;
  8. using namespace std;
  9. //typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
  10. //typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pbtrie;
  11.  
  12. #define ll                       long long int
  13. #define mod                      1000000007
  14. #define inf                      1e18
  15. #define pb                       push_back
  16. #define vi                       vector<ll>
  17. #define vs                       vector<string>
  18. #define pii                      pair<ll,ll>
  19. #define ump                      unordered_map
  20. #define mp                       make_pair
  21. #define pq_max                   priority_queue<ll>
  22. #define pq_min                   priority_queue<ll,vi,greater<ll> >
  23. #define all(n)                   n.begin(),n.end()
  24. #define ff                       first
  25. #define ss                       second
  26. #define mid(l,r)                 (l+(r-l)/2)
  27. #define bitc(n)                  __builtin_popcount(n)
  28. #define SET(a)                   memset( a, -1, sizeof a )
  29. #define CLR(a)                   memset( a,  0, sizeof a )
  30. #define Pi                       3.141592653589793
  31. #define loop(x,start,end)        for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
  32. #define _fast                    ios_base::sync_with_stdio(0);  cin.tie(0); cout.tie(0);
  33. #define iter(container,it)       for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
  34. #define log(args...)             {string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
  35. #define logarr(arr,a,b)          for(int z=(a);z<=(b);z++) cout<<(arr[z])<<" ";cout<<endl;
  36. template <typename T> T          gcd(T a, T b){if(a%b) return gcd(b,a%b);return b;}
  37. template <typename T> T          lcm(T a, T b){return (a*(b/gcd(a,b)));}
  38. vs tokenizer(string str,char ch) {std::istringstream var((str)); vs v; string t; while(getline((var), t, (ch))) {v.pb(t);} return v;}
  39.  
  40. void err(istream_iterator<string> it) {}
  41. template<typename T, typename... Args>
  42. void err(istream_iterator<string> it, T a, Args... args) {
  43. cout << *it << " = " << a << endl;
  44. err(++it, args...);
  45. }
  46.  
  47. void solve() {
  48.     // ll n; cin >> n;
  49.     loop (n,1,100) {
  50.         cout << n << ":- ";
  51.         loop (i,1,n) {
  52.             ll j = n-i;
  53.             if ((i+j) == 2*(i^j) && (i+j) == n) {
  54.                 cout << "{"<< i << "," << j << "}, ";
  55.             }
  56.            
  57.         }
  58.         cout << "\n";
  59.     }
  60. }
  61.  
  62. int main(int argc, char const *argv[]){
  63.     _fast
  64.   //#ifndef ONLINE_JUDGE
  65.         //freopen("input.txt", "r", stdin);
  66.         //freopen("output.txt", "w", stdout);
  67.   //#endif
  68.     ll t; cin>>t;
  69.     while(t--){
  70.      solve();
  71.     }
  72.   return 0;
  73. }
  74. /*
  75. 1:-
  76. 2:-
  77. 3:-
  78. 4:- {1,3}, {3,1},
  79. 5:-
  80. 6:-
  81. 7:-
  82. 8:- {2,6}, {6,2},
  83. 9:-
  84. 10:-
  85. 11:-
  86. 12:-
  87. 13:-
  88. 14:-
  89. 15:-
  90. 16:- {4,12}, {12,4},
  91. 17:-
  92. 18:-
  93. 19:-
  94. 20:- {5,15}, {7,13}, {13,7}, {15,5},
  95. 21:-
  96. 22:-
  97. 23:-
  98. 24:-
  99. 25:-
  100. 26:-
  101. 27:-
  102. 28:-
  103. 29:-
  104. 30:-
  105. 31:-
  106. 32:- {8,24}, {24,8},
  107. 33:-
  108. 34:-
  109. 35:-
  110. 36:- {9,27}, {11,25}, {25,11}, {27,9},
  111. 37:-
  112. 38:-
  113. 39:-
  114. 40:- {10,30}, {14,26}, {26,14}, {30,10},
  115. 41:-
  116. 42:-
  117. 43:-
  118. 44:-
  119. 45:-
  120. 46:-
  121. 47:-
  122. 48:-
  123. 49:-
  124. 50:-
  125. 51:-
  126. 52:-
  127. 53:-
  128. 54:-
  129. 55:-
  130. 56:-
  131. 57:-
  132. 58:-
  133. 59:-
  134. 60:-
  135. 61:-
  136. 62:-
  137. 63:-
  138. 64:- {16,48}, {48,16},
  139. 65:-
  140. 66:-
  141. 67:-
  142. 68:- {17,51}, {19,49}, {49,19}, {51,17},
  143. 69:-
  144. 70:-
  145. 71:-
  146. 72:- {18,54}, {22,50}, {50,22}, {54,18},
  147. 73:-
  148. 74:-
  149. 75:-
  150. 76:-
  151. 77:-
  152. 78:-
  153. 79:-
  154. 80:- {20,60}, {28,52}, {52,28}, {60,20},
  155. 81:-
  156. 82:-
  157. 83:-
  158. 84:- {21,63}, {23,61}, {29,55}, {31,53}, {53,31}, {55,29}, {61,23}, {63,21},
  159. 85:-
  160. 86:-
  161. 87:-
  162. 88:-
  163. 89:-
  164. 90:-
  165. 91:-
  166. 92:-
  167. 93:-
  168. 94:-
  169. 95:-
  170. 96:-
  171. 97:-
  172. 98:-
  173. 99:-
  174. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement