結果

問題 No.1803 Remainder of Sum
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-12-16 21:24:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 324 ms / 2,000 ms
コード長 182 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 78,232 KB
最終ジャッジ日時 2023-10-12 10:52:08
合計ジャッジ時間 5,430 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,436 KB
testcase_01 AC 320 ms
77,564 KB
testcase_02 AC 316 ms
77,532 KB
testcase_03 AC 324 ms
77,472 KB
testcase_04 AC 313 ms
77,460 KB
testcase_05 AC 317 ms
77,472 KB
testcase_06 AC 315 ms
78,232 KB
testcase_07 AC 303 ms
77,220 KB
testcase_08 AC 309 ms
77,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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