Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define task "CALCULATE"
- #include <iostream>
- #include <cstdio>
- using namespace std;
- using ll = long long;
- using ld = long double;
- constexpr int N = 1e5 + 5;
- ll n;
- #define Cal(a, b) ((b) - (a) + 1)
- void Solve()
- {
- ll ans = 0;
- for (ll i = 1; i <= n / i; ++i)
- ans += Cal(n / (i + 1) + 1, n / i) * i;
- for (ll i = 1; i < n / i; ++i)
- ans += n / i;
- cout << ans << '\n';
- }
- int32_t main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- if (fopen(task ".INP", "r"))
- {
- freopen(task ".INP", "r", stdin);
- freopen(task ".OUT", "w", stdout);
- }
- while (cin >> n)
- {
- Solve();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement