結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー ebi_flyebi_fly
提出日時 2024-02-23 22:25:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,484 ms / 2,000 ms
コード長 295 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 13,448 KB
最終ジャッジ日時 2024-04-16 15:09:03
合計ジャッジ時間 17,630 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 1,439 ms
10,752 KB
testcase_02 AC 1,427 ms
10,752 KB
testcase_03 AC 1,422 ms
10,752 KB
testcase_04 AC 1,460 ms
10,880 KB
testcase_05 AC 1,477 ms
10,752 KB
testcase_06 AC 1,484 ms
10,752 KB
testcase_07 AC 104 ms
10,752 KB
testcase_08 AC 101 ms
10,880 KB
testcase_09 AC 45 ms
10,752 KB
testcase_10 AC 45 ms
10,880 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 31 ms
10,624 KB
testcase_13 AC 147 ms
12,668 KB
testcase_14 AC 135 ms
12,416 KB
testcase_15 AC 121 ms
12,544 KB
testcase_16 AC 126 ms
12,392 KB
testcase_17 AC 164 ms
13,016 KB
testcase_18 AC 124 ms
12,512 KB
testcase_19 AC 143 ms
12,716 KB
testcase_20 AC 208 ms
13,432 KB
testcase_21 AC 143 ms
12,980 KB
testcase_22 AC 149 ms
12,928 KB
testcase_23 AC 213 ms
13,348 KB
testcase_24 AC 213 ms
13,316 KB
testcase_25 AC 215 ms
13,284 KB
testcase_26 AC 214 ms
13,316 KB
testcase_27 AC 213 ms
13,316 KB
testcase_28 AC 214 ms
13,316 KB
testcase_29 AC 212 ms
13,320 KB
testcase_30 AC 215 ms
13,320 KB
testcase_31 AC 214 ms
13,448 KB
testcase_32 AC 212 ms
13,316 KB
testcase_33 AC 212 ms
13,316 KB
testcase_34 AC 1,467 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.set_int_max_str_digits(10**7)

t = int(input())
for i in range(t):
    n,m = map(int, input().split())
    ans = n
    if ans % 2 == 0:
        ans //= 2
        ans %= m
        ans *= n + 1
    else:
        ans %= m
        ans *= ((n + 1) // 2) % m
    ans %= m
    print(ans)
0