結果

問題 No.1803 Remainder of Sum
ユーザー KudeKude
提出日時 2022-01-07 22:18:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 312 ms / 2,000 ms
コード長 228 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 76,800 KB
最終ジャッジ日時 2024-04-26 18:45:00
合計ジャッジ時間 3,913 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,584 KB
testcase_01 AC 299 ms
76,544 KB
testcase_02 AC 298 ms
76,288 KB
testcase_03 AC 311 ms
76,288 KB
testcase_04 AC 312 ms
76,288 KB
testcase_05 AC 307 ms
76,800 KB
testcase_06 AC 306 ms
76,032 KB
testcase_07 AC 297 ms
76,672 KB
testcase_08 AC 302 ms
76,672 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