結果
| 問題 | No.2132 1 or X Game |
| コンテスト | |
| ユーザー |
とりゐ
|
| 提出日時 | 2022-11-25 21:50:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 349 bytes |
| 記録 | |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 76,800 KB |
| 最終ジャッジ日時 | 2024-10-02 04:26:06 |
| 合計ジャッジ時間 | 7,872 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 6 WA * 5 |
ソースコード
mod=998244353
def solve():
n,x=map(int,input().split())
N=n
if x%2==1:
lose=n//2
print((n-lose)%mod)
return
lose=(n//(2*(x+1)))*x
#print(lose)
n%=(2*(x+1))
lose+=min(x//2,n//2+1)
#print(lose)
n-=x+1
lose+=max(0,min(x//2,n//2+1))
#print(lose)
ans=N+1-lose
print(ans%mod)
for _ in range(int(input())):
solve()
とりゐ