結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー Ekiben542Ekiben542
提出日時 2024-03-03 21:49:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,394 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 1,511 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 11,260 KB
最終ジャッジ日時 2024-03-03 21:50:15
合計ジャッジ時間 27,308 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
9,984 KB
testcase_01 AC 1,321 ms
10,112 KB
testcase_02 AC 1,341 ms
10,112 KB
testcase_03 AC 1,317 ms
10,112 KB
testcase_04 AC 1,344 ms
10,112 KB
testcase_05 AC 1,394 ms
10,112 KB
testcase_06 AC 1,393 ms
10,112 KB
testcase_07 AC 94 ms
10,112 KB
testcase_08 AC 96 ms
10,112 KB
testcase_09 AC 43 ms
10,112 KB
testcase_10 AC 41 ms
10,112 KB
testcase_11 AC 28 ms
9,984 KB
testcase_12 AC 29 ms
9,984 KB
testcase_13 AC 385 ms
10,496 KB
testcase_14 AC 326 ms
10,496 KB
testcase_15 AC 263 ms
10,496 KB
testcase_16 AC 313 ms
10,496 KB
testcase_17 AC 575 ms
11,008 KB
testcase_18 AC 282 ms
10,624 KB
testcase_19 AC 390 ms
10,752 KB
testcase_20 AC 852 ms
11,260 KB
testcase_21 AC 432 ms
10,880 KB
testcase_22 AC 422 ms
10,816 KB
testcase_23 AC 884 ms
10,884 KB
testcase_24 AC 895 ms
10,884 KB
testcase_25 AC 890 ms
10,884 KB
testcase_26 AC 898 ms
10,884 KB
testcase_27 AC 882 ms
10,884 KB
testcase_28 AC 897 ms
10,884 KB
testcase_29 AC 888 ms
10,884 KB
testcase_30 AC 876 ms
10,884 KB
testcase_31 AC 903 ms
10,884 KB
testcase_32 AC 890 ms
10,884 KB
testcase_33 AC 910 ms
10,884 KB
testcase_34 AC 1,337 ms
10,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.set_int_max_str_digits(4*10**6)
class Summation:
    def __init__(self, n, m):
        self.n = n
        self.m = m

    def calculate(self):
        n, m = self.n, self.m
        n1 = n % m
        n2 = (n + 1) % m
        if n % 2 == 0:
            return ((n // 2) % m * n2) % m
        else:
            return (n1 * ((n + 1) // 2) % m) % m

T = int(input())  
for _ in range(T):
    N, M = map(int, input().split())
    summation = Summation(N, M)
    print(summation.calculate())
0