結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー 👑 rin204
提出日時 2024-02-23 21:29:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 645 ms / 2,000 ms
コード長 304 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 80,016 KB
最終ジャッジ日時 2024-09-29 05:34:10
合計ジャッジ時間 10,293 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.set_int_max_str_digits(10**7)


def solve():
    n, m = map(int, input().split())
    print(n * (n + 1) // 2 % m)
    return
    if n < m:
        print(n * (n + 1) // 2 % m)
        return
    n %= m
    n += m
    print(n * (n + 1) // 2 % m)


for _ in range(int(input())):
    solve()
0