tuki2501

BSBB.cpp

Nov 25th, 2021
654
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. #define taskname "BSBB"
  5.  
  6. typedef long long ll;
  7.  
  8. const int N = 1000001;
  9.  
  10. int cnt[N];
  11.  
  12. int main() {
  13.   for (int i = 1; i < N; i++)
  14.   for (int j = i; j < N; j += i) {
  15.     cnt[j]++;
  16.   }
  17.   int n; cin >> n;
  18.   ll ans = 0;
  19.   for (int i = 1; i < n; i++) {
  20.     ans += cnt[i];
  21.   }
  22.   cout << ans << '\n';
  23. }
  24.  
RAW Paste Data