[Codeforces] Educational Codeforces Round 99 (Div. 2) C. Ping-pong

2020年12月12日

問題

方針

自分の勝利の最大化が一番優先されるので、ボブの勝利数が \( y \) となるかを考えます。もしアリスのサーブを全て返さずに、アリスのスタミナが \( 0 \) となったとき、ボブとアリスの勝利数は、\( x, y \) となります。ボブがアリスの最後のサーブを返した場合は、\( x – 1, y \) となるので、これが最適です。

コード

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int t, x, y;
    cin >> t;
    while (t--) {
        cin >> x >> y;
        cout << x - 1 << " " << y << "\n";
    }
    return 0;
}