MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

String/soldier.cpp:12–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#define dd double
11using namespace std;
12int main() {
13 ios::sync_with_stdio(false);
14 ll n, m, k; cin >> n >> m >> k;
15 ll sum = 0;
16 for (ll i = 1; i <= k; i++) {
17 sum += n * i;
18 }
19 sum -= m;
20 if (sum <= 0) {
21 cout << "0" << endl;
22 }
23 else {
24 cout << sum << endl;
25 }
26}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected