結果

問題 No.2132 1 or X Game
ユーザー titia
提出日時 2022-11-30 02:01:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 236 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-07 09:06:02
合計ジャッジ時間 2,534 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for tests in range(T):
    N,X=map(int,input().split())

    if X%2==1:
        print(((N+1)//2)%mod)
    else:
        lo=(N+1)//(X+1)
        ANS=lo*(X//2+1)

        rest=N-lo*(X+1)
        print((ANS+(rest+1)//2)%mod)
0