mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 21:28:48 +00:00
720. 连续整数相加
https://www.acwing.com/problem/content/submission/code_detail/2846068/
This commit is contained in:
parent
54ec15dc5a
commit
aba7f11c01
19
AcWing/720/720.cpp
Normal file
19
AcWing/720/720.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user