Advertisement
LEGEND2004

Random Teams

Jul 18th, 2023
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define int long long
  5. #define pb push_back
  6.  
  7. int f(int n){
  8. int hi = n * (n - 1);
  9. hi /= 2;
  10. return hi;
  11. }
  12.  
  13. signed main()
  14. {
  15. int n , k;
  16. cin >> n >> k;
  17. // second number in output
  18. int big = n - (k - 1);
  19. int maximum = f(big);
  20.  
  21. //first number in output
  22. int small = n / k;
  23. int minumum = k * f(small);
  24. minumum += ((n % k) * small);
  25.  
  26. cout << minumum << " " << maximum << endl;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement