0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 14:36:27 +00:00

714. 连续奇数的和 1

https://www.acwing.com/problem/content/submission/code_detail/14061154/
This commit is contained in:
Baoshuo Ren 2022-05-09 17:20:01 +08:00
parent 12cea7d0b8
commit 58db81b52b
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

23
AcWing/714/714.cpp Normal file
View File

@ -0,0 +1,23 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
int x, y, ans;
int main() {
std::ios::sync_with_stdio(false);
cin >> x >> y;
if (y < x) std::swap(x, y);
for (int i = x + 1; i < y; i++) {
if (i & 1) ans += i;
}
cout << ans << endl;
return 0;
}