結果
| 問題 | No.1803 Remainder of Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-12-16 21:24:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 327 ms / 2,000 ms |
| コード長 | 182 bytes |
| 記録 | |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 82,372 KB |
| 実行使用メモリ | 76,672 KB |
| 最終ジャッジ日時 | 2024-09-14 09:44:10 |
| 合計ジャッジ時間 | 4,882 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 8 |
ソースコード
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)