結果
問題 | No.1803 Remainder of Sum |
ユーザー | NatsubiSogan |
提出日時 | 2021-12-17 09:30:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 127 ms / 2,000 ms |
コード長 | 319 bytes |
コンパイル時間 | 306 ms |
コンパイル使用メモリ | 87,132 KB |
実行使用メモリ | 77,656 KB |
最終ジャッジ日時 | 2023-10-12 10:52:12 |
合計ジャッジ時間 | 2,815 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
71,284 KB |
testcase_01 | AC | 124 ms
77,656 KB |
testcase_02 | AC | 125 ms
77,448 KB |
testcase_03 | AC | 125 ms
77,308 KB |
testcase_04 | AC | 126 ms
77,604 KB |
testcase_05 | AC | 127 ms
77,476 KB |
testcase_06 | AC | 122 ms
77,248 KB |
testcase_07 | AC | 117 ms
77,340 KB |
testcase_08 | AC | 120 ms
77,612 KB |
ソースコード
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()