結果

問題 No.2132 1 or X Game
ユーザー ぷら
提出日時 2022-11-07 01:47:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 510 bytes
コンパイル時間 2,016 ms
コンパイル使用メモリ 191,836 KB
最終ジャッジ日時 2025-02-08 19:06:54
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

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

constexpr int mod = 998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while(t--) {
        long long n,x;
        cin >> n >> x;
        if(x%2 == 1) {
            cout << (n+1)/2%mod << "\n";
        }
        else {
            if(n < x) {
                cout << (n+1)/2%mod << "\n";
            }
            else {
                cout << (x/2+(n-x)/2+1)%mod << "\n";
            }
        }
    }
}
0