結果
| 問題 | No.1803 Remainder of Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-12-16 21:24:40 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 239 ms / 2,000 ms |
| コード長 | 182 bytes |
| 記録 | |
| コンパイル時間 | 269 ms |
| コンパイル使用メモリ | 85,212 KB |
| 実行使用メモリ | 81,408 KB |
| 最終ジャッジ日時 | 2026-04-04 11:54:41 |
| 合計ジャッジ時間 | 2,720 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)