結果
| 問題 | No.1803 Remainder of Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-12-17 09:30:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 105 ms / 2,000 ms |
| コード長 | 319 bytes |
| 記録 | |
| コンパイル時間 | 357 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 76,236 KB |
| 最終ジャッジ日時 | 2024-09-14 09:44:12 |
| 合計ジャッジ時間 | 2,484 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 8 |
ソースコード
def main():
import sys
input = sys.stdin.buffer.readline
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)
if __name__ == '__main__':
main()