結果
| 問題 | No.2132 1 or X Game |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-11 19:28:16 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 327 ms / 2,000 ms |
| コード長 | 520 bytes |
| 記録 | |
| コンパイル時間 | 472 ms |
| コンパイル使用メモリ | 79,744 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-06-28 21:22:38 |
| 合計ジャッジ時間 | 8,058 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 |
ソースコード
#include <iostream>
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
int main()
{
int t;
cin >> t;
while (t--)
{
ll n, x;
cin >> n >> x;
if (x % 2 || n < x)
{
cout << (n + 1) / 2 % MOD << endl;
}
else
{
ll ans = x / 2;
n -= x - 1;
ans += n / (x + 3) * (x / 2 + 2);
n %= x + 3;
ans += (n + 1) / 2;
cout << ans % MOD << endl;
}
}
}