Saturday, May 21, 2016

CF 546A

#include<bits/stdc++.h>
using namespace std;

int main()
{
    long long k,n,w,ans = 0;
    cin >> k >> n >> w;
    for(int i = 1; i <= w; i++){
        ans += i*k;
    }
    ans-=n;
    if(ans <= 0)cout << 0 << endl;
    else cout << ans << endl;
    return 0;
}

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)