Guest User

Untitled

a guest
Apr 26th, 2020
85
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61};
  6.     uint64_t a, b; cin >> a >> b;
  7.  
  8.     uint64_t ans = 0;
  9.     for (int prime : primes) {
  10.         uint64_t l = (1ULL << (prime - 1));
  11.         uint64_t r = (1ULL << prime) - 1;
  12.         if ((a <= l && l <= b) || (a <= r && r <= b))
  13.             ans += min(b, r) - max(a, l) + 1;
  14.     }
  15.  
  16.     cout << ans << '\n';
  17.     return 0;
  18. }
RAW Paste Data