Untitled

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

int main()
{
	int k,n,w;//k-1 banan, n - kal babok, w - kal banan
	int sum = 0;
	cin >> k >> n >> w;

	for (int i = 1; i <= w; i++) {
		sum += i * k;
	}
	if (sum > n) {
		cout << sum - n;
	}
}
Leave a Comment