A. Soldier and Bananas
原题传送门
代码
#include <bits/stdc++.h> using namespace std; #define reset(x) memset(x, 0, sizeof(x)); #define recopy(a, b) memcpy(b, a, sizeof(a)); typedef unsigned long long ULL; typedef long long LL; const int mod = 1e9 + 7; const int maxn = 2e5 + 10; int main() { ios::sync_with_stdio(false); int k, n, w; cin >> k >> n >> w; int sum = 0; for (int i = 1; i <= w; i++) sum += k * i; if (sum > n) cout << sum - n << endl; else cout << 0 << endl; return 0; }
c/c++开发分享A. Soldier and Bananas地址:https://blog.csdn.net/w_weirdo/article/details/108166057
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/c-cdevelopment/597693.html