forked from abheekd/usaco-practice
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
294 B
19 lines
294 B
3 years ago
|
using namespace std;
|
||
|
|
||
|
#include <iostream>
|
||
|
|
||
|
int main() {
|
||
|
int k, n, total_cost;
|
||
|
total_cost = 0;
|
||
|
long w;
|
||
|
cin >> k >> n >> w;
|
||
|
for (int i = 1; i < w + 1; i++) {
|
||
|
total_cost += i * k;
|
||
|
}
|
||
|
total_cost -= n;
|
||
|
if (total_cost < 0) {
|
||
|
total_cost = 0;
|
||
|
}
|
||
|
cout << total_cost << endl;
|
||
|
}
|