結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー 👑 rin204rin204
提出日時 2024-02-23 21:29:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 672 ms / 2,000 ms
コード長 304 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 79,516 KB
最終ジャッジ日時 2024-02-23 21:29:59
合計ジャッジ時間 10,668 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 503 ms
76,016 KB
testcase_02 AC 529 ms
76,016 KB
testcase_03 AC 496 ms
76,016 KB
testcase_04 AC 526 ms
76,016 KB
testcase_05 AC 640 ms
76,000 KB
testcase_06 AC 672 ms
76,000 KB
testcase_07 AC 110 ms
76,000 KB
testcase_08 AC 110 ms
76,000 KB
testcase_09 AC 82 ms
74,336 KB
testcase_10 AC 80 ms
74,208 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 38 ms
53,460 KB
testcase_13 AC 143 ms
74,244 KB
testcase_14 AC 125 ms
73,236 KB
testcase_15 AC 115 ms
72,740 KB
testcase_16 AC 124 ms
73,268 KB
testcase_17 AC 156 ms
75,220 KB
testcase_18 AC 118 ms
73,636 KB
testcase_19 AC 144 ms
74,660 KB
testcase_20 AC 221 ms
79,516 KB
testcase_21 AC 145 ms
74,020 KB
testcase_22 AC 147 ms
74,988 KB
testcase_23 AC 221 ms
79,292 KB
testcase_24 AC 220 ms
79,420 KB
testcase_25 AC 226 ms
79,292 KB
testcase_26 AC 223 ms
79,420 KB
testcase_27 AC 223 ms
79,292 KB
testcase_28 AC 225 ms
79,420 KB
testcase_29 AC 228 ms
79,420 KB
testcase_30 AC 222 ms
79,036 KB
testcase_31 AC 248 ms
78,908 KB
testcase_32 AC 223 ms
79,292 KB
testcase_33 AC 209 ms
78,524 KB
testcase_34 AC 524 ms
76,016 KB
権限があれば一括ダウンロードができます

ソースコード

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