Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- typedef long long int ll;
- using namespace std;
- int main()
- {
- ll n;
- while(cin >> n and n)
- {
- ll res = 0, p = 0 ,a;
- ll k = 1;
- for(int i = 1; i <= n; i++)
- {
- if(k >= n)
- break;
- a = n / k , p = n / a;
- res += a * ((k + p) * (p -k + 1)/ 2);
- k = p + 1;
- }
- cout<< res - 1<< endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement