fork(1) download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. void solve() {
  6.  
  7. int ans = -1;
  8.  
  9. int x;
  10.  
  11. cin >> x;
  12.  
  13. int y;
  14.  
  15. for(int i = 0; i < 30; i++) {
  16.  
  17. for(int j = 0; j < 30; j++) {
  18.  
  19. y = (1 << i) | (1 << j);
  20.  
  21. if(y < x && (x + y > (x ^ y)) && (y + (x ^ y) > x)) {
  22.  
  23. ans = y;
  24.  
  25. }
  26.  
  27. }
  28.  
  29. }
  30.  
  31. cout << y << endl;
  32.  
  33. }
  34.  
  35. int main() {
  36.  
  37. ios_base::sync_with_stdio(false);
  38. cin.tie(0);
  39.  
  40. int t;
  41.  
  42. cin >> t;
  43.  
  44. while(t--) {
  45.  
  46. solve();
  47.  
  48. }
  49.  
  50. return 0;
  51.  
  52. }
Success #stdin #stdout 0.01s 5288KB
stdin
7
5
2
6
3
69
4
420
stdout
536870912
536870912
536870912
536870912
536870912
536870912
536870912