fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. long long f(long long x)
  5. {
  6. long long chia2 = x / 2;
  7. long long chia3 = x / 3;
  8. long long chia6 = x / 6;
  9. return (chia2 + chia3 - chia6);
  10. }
  11. int main()
  12. {
  13. freopen("CNTSEQ.inp", "r", stdin);
  14. freopen("CNTSEQ.out", "w", stdout);
  15.  
  16. long long a, b;
  17. cin >> a >> b;
  18. cout << f(b) - f(a - 1);
  19. }
  20.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty