Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- #define pb push_back
- int f(int n){
- int hi = n * (n - 1);
- hi /= 2;
- return hi;
- }
- signed main()
- {
- int n , k;
- cin >> n >> k;
- // second number in output
- int big = n - (k - 1);
- int maximum = f(big);
- //first number in output
- int small = n / k;
- int minumum = k * f(small);
- minumum += ((n % k) * small);
- cout << minumum << " " << maximum << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement