Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
329 B
0
Indexable
Never
#include <iostream>
using namespace std;

int main()
{
	int k, w, n, b = 0, i = 1; // b -cena banana voobshe         i - nomer banana
	cin >> k >> n >> w; // k -cena banana      n - koivo babla       w - kolvo banana 
	while (w)
	{
		b += k * i;
		i++;
		w--;
	}
	if (n >= b) cout << "0";
	else cout << (n-b)*-1;
}
Leave a Comment