rengetsu

Codeforces_546A

Jul 21st, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <cmath>
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int k, n, w, sum=0, answ;
  7.     cin >> k >> n >> w;
  8.     for(int i=1;i<w+1;i++)
  9.     {
  10.         sum+=i*k;
  11.     }
  12.     if(sum>n){cout << abs(n-sum);}
  13.     else{cout<<"0";}
  14.     return 0;
  15. }
Add Comment
Please, Sign In to add comment