Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // AndeyLess
- //
- // Created by Kadir Kadyrov on 08.07.2020.
- // Copyright © 2020 Kadir Kadyrov. All rights reserved.
- //
- #include <iostream>
- #include <vector>
- #include <queue>
- #include <algorithm>
- using namespace std;
- //int main () {
- // int k, w, n;
- // cin >> k >> n >> w;
- //
- // long long ans = (k * w * (w + 1)) / 2;
- //
- // if (ans > n) {
- // cout << ans - n << endl;
- // } else {
- // cout << 0 << endl;
- // }
- //}
- int main () {
- int k, n, w;
- cin >> k >> n >> w;
- int ans = 0;
- for (int i = 1; i <= w; i++) {
- ans += i * k;
- }
- if (ans > n) {
- cout << ans - n << endl;
- } else {
- cout << 0 << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement