fork download
  1. #include<bits/stdc++.h>
  2. #define endl "\n"
  3. #define ll long long
  4. using namespace std;
  5. constexpr ll N = 1e6 + 7, mod = 1000000007, inf = 0x3f3f3f3f3f3f3f3f;
  6.  
  7. void solve(int tc) {
  8. ll x;
  9. cin >> x;
  10. ll a = 0 , b = 0;
  11. ll f = 1;
  12. for (int i = 62 ; i ; i --) {
  13. if (x >> i &1) {
  14. if (f ) {
  15. b |= (1ll << i);
  16. f--;
  17. }else {
  18. a |= (1ll<< i);
  19. }
  20. }
  21. }
  22. cout << a << ' ' << b<<endl;
  23. }
  24.  
  25. int main() {
  26. #ifndef ONLINE_JUDGE
  27. freopen("input.txt", "r",stdin);
  28. freopen("output.txt", "w",stdout);
  29. #endif
  30. ios_base::sync_with_stdio(false);
  31. cin.tie(nullptr);
  32. cout.tie(nullptr);
  33. int TC = 1; cin>>TC;
  34. for (int i = 1; i <= TC; i++) {
  35. solve(i);
  36. }
  37. }
  38.  
Success #stdin #stdout 0s 544KB
stdin
Standard input is empty
stdout
0 0