Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
276 B
0
Indexable
Never
#include <iostream>
using namespace std;
int main()
{
int k, w, n, b = 0, i = 1;
    cin >> k >> n >> w;
    while (w)
    {
        b += k * i;
        i++;
        w--;
    }
    if (n >= b)
        cout << '0';
    else
        cout << (n - b) * -1;
    
}
Leave a Comment