乒乓博弈

· · 题解

大意

略,题目说的很清楚了。

思路

最大情况为第一局打完后,小 s 一直站在场上没下来,局数为 n - 1;最小情况为,第一句打完后,小 s 在上面一局,旁观一局,所以局数为 \lfloor{n / 2}\rfloor。

代码

:::::warning[先看思路,不许抄袭]

#include <bits/stdc++.h>
using namespace std;
long long t, n;
int main(){
    cin >> t;
    while (t--) {
        cin >> n;
        cout << n - 1 << " " << n / 2 << endl;
    }
    return 0;
}

:::::