結果

問題 No.1803 Remainder of Sum
ユーザー NatsubiSogan
提出日時 2021-12-16 21:11:13
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 763 ms / 2,000 ms
コード長 182 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-14 09:44:20
合計ジャッジ時間 6,999 ms
ジャッジサーバーID
(参考情報)
judge3 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

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