Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1.  
  2. #include "testlib.h"
  3. #include <algorithm>
  4. #include <cassert>
  5. #include <cmath>
  6. #include <deque>
  7. #include <iomanip>
  8. #include <iostream>
  9. #include <map>
  10. #include <queue>
  11. #include <set>
  12. #include <string>
  13. #include <time.h>
  14. #include <vector>
  15.  
  16. using namespace std;
  17.  
  18.     const int INF = 1e9 + 228;
  19.  
  20.     const int MAXLEN = 62;
  21.  
  22. vector<int> toBin(long long x)
  23. {
  24.     vector<int> result;
  25.     while (x)
  26.     {
  27.         result.push_back(x % 2);
  28.         x /= 2;
  29.     }
  30.     reverse(result.begin(), result.end());
  31.     return result;
  32. }
  33.  
  34. void solve(int argc, char* argv[])
  35. {
  36.     registerGen(argc, argv, 1);
  37.     vector<int> A, B;
  38.  
  39.     long long a, b;
  40.     do
  41.     {
  42.         a = rnd.next(0LL, (long long) 1e18);
  43.         b = rnd.next(0LL, (long long) 1e18);
  44.         A = toBin(a);
  45.         B = toBin(b);
  46.         cout << A.size() << " " << B.size() << endl;
  47.     }
  48.     while (A.size() + B.size() > MAXLEN);
  49.  
  50.     cout << a << " " << b << endl;
  51. }
  52.  
  53. int main(int argc, char* argv[])
  54. {
  55. #ifdef _DEBUG
  56.     freopen("input.txt", "r", stdin);
  57.     //freopen("output.txt", "w", stdout);
  58. #endif
  59.     //srand(time(NULL));
  60.  
  61.     solve(argc, argv);
  62.  
  63.     return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement