Untitled

Anonymous
c_cpp
11/26/2023 9:41 AM
368 B
17
Indexable
#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;
    
}
Editor is loading...
Leave a Comment