結果

問題 No.1803 Remainder of Sum
ユーザー KudeKude
提出日時 2022-01-07 22:18:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 78,604 KB
最終ジャッジ日時 2023-08-09 03:21:43
合計ジャッジ時間 4,735 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,356 KB
testcase_01 AC 319 ms
77,416 KB
testcase_02 AC 309 ms
77,192 KB
testcase_03 AC 318 ms
77,464 KB
testcase_04 AC 316 ms
77,772 KB
testcase_05 AC 306 ms
77,220 KB
testcase_06 AC 317 ms
78,604 KB
testcase_07 AC 307 ms
77,748 KB
testcase_08 AC 304 ms
77,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    n, m = map(int, input().split())
    if m == 1:
        print(0)
    elif n >= m:
        print(m // 2)
    else:
        l = m - n - 1
        print(m // 2 - (m - n) + (2 + m - n) * l // 2 + l)
0