题解:P15328 [GCPC 2025] Around the Table
思路
游戏规则:左右队首配对后,两人分别跑到队尾。
设总人数
当
当
否则,总数为
代码
#include <bits/stdc++.h>
using namespace std;
int main() {
int l, r;
cin >> l >> r;
long long sum = l + r; //要开long long
if (r == l - 1) {
cout << sum;
} else if (r == l || r == l - 2) {
cout << sum * 3 / 2;
} else {
cout << 2 * sum;
}
return 0;
}
record