Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define times(I, X) for (int I=0; I<X; I++)
  4. #define rtimes(I, X) for(int I=X; I>=0; I--)
  5.  
  6. #ifdef DEBUG
  7. #define dump(X) std::cout << __LINE__ << "L: [" << #X << "] = [" << X << "]\n"
  8. #else
  9. #define dump(X)
  10. #endif
  11. #define pb push_back
  12. #define int long long
  13. #define fi first
  14. #define se second
  15.  
  16. using namespace std;
  17. const int sze = 2e5;
  18.  
  19. long long binpow (long long a, long long n)
  20. {
  21. long long res = 1;
  22. while (n)
  23. {
  24. if (n & 1)
  25. res *= a;
  26. a *= a;
  27. n >>= 1;
  28. }
  29. return res;
  30. }
  31.  
  32.  
  33.  
  34. signed main() {
  35. #ifndef DEBUG
  36. ios_base::sync_with_stdio(0);
  37. cin.tie(0);
  38. cout.tie(0);
  39. // freopen("basis.in", "r", stdin);
  40. // freopen("basis.out", "w", stdout);
  41. #endif
  42. int n = 2021;
  43. int res = 0;
  44. vector<int> vec(2021);
  45. vec[1] = 1;
  46. for(int i = 2; i < n; i++)
  47. {
  48. if(i % 2 == 0)
  49. {
  50. vec[i] = vec[i / 2];
  51. }
  52. else{
  53. vec[i] = vec[i / 2] + 1;
  54. }
  55. if(vec[i] == 9)
  56. {
  57. res++;
  58. cout << i << " " << vec[i] << endl;
  59. }
  60. }
  61. cout << res;
  62. return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement