0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-16 20:25:24 +00:00

720. 连续整数相加

https://www.acwing.com/problem/content/submission/code_detail/2846068/
This commit is contained in:
Baoshuo Ren 2020-11-05 19:10:00 +08:00
parent 54ec15dc5a
commit aba7f11c01
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

19
AcWing/720/720.cpp Normal file
View File

@ -0,0 +1,19 @@
#include <bits/stdc++.h>
using namespace std;
int a, n, ans;
int main() {
cin >> a;
while (cin >> n, n <= 0) {}
for (int i = 0; i < n; i++) {
ans += i + a;
}
cout << ans << endl;
return 0;
}