結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー obemaru4012obemaru4012
提出日時 2024-02-25 01:22:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,451 ms / 2,000 ms
コード長 842 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 11,128 KB
最終ジャッジ日時 2024-02-25 01:23:18
合計ジャッジ時間 27,382 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,856 KB
testcase_01 AC 1,419 ms
9,984 KB
testcase_02 AC 1,405 ms
9,984 KB
testcase_03 AC 1,401 ms
9,984 KB
testcase_04 AC 1,409 ms
9,984 KB
testcase_05 AC 1,431 ms
9,984 KB
testcase_06 AC 1,451 ms
9,984 KB
testcase_07 AC 128 ms
9,984 KB
testcase_08 AC 100 ms
9,984 KB
testcase_09 AC 43 ms
9,984 KB
testcase_10 AC 44 ms
9,984 KB
testcase_11 AC 30 ms
9,856 KB
testcase_12 AC 31 ms
9,856 KB
testcase_13 AC 395 ms
10,368 KB
testcase_14 AC 338 ms
10,368 KB
testcase_15 AC 292 ms
10,368 KB
testcase_16 AC 316 ms
10,368 KB
testcase_17 AC 559 ms
10,880 KB
testcase_18 AC 314 ms
10,496 KB
testcase_19 AC 399 ms
10,624 KB
testcase_20 AC 889 ms
11,128 KB
testcase_21 AC 418 ms
10,752 KB
testcase_22 AC 431 ms
10,684 KB
testcase_23 AC 925 ms
10,752 KB
testcase_24 AC 920 ms
10,752 KB
testcase_25 AC 915 ms
10,752 KB
testcase_26 AC 895 ms
10,752 KB
testcase_27 AC 922 ms
10,752 KB
testcase_28 AC 924 ms
10,752 KB
testcase_29 AC 900 ms
10,752 KB
testcase_30 AC 926 ms
10,752 KB
testcase_31 AC 924 ms
10,752 KB
testcase_32 AC 923 ms
10,752 KB
testcase_33 AC 895 ms
10,752 KB
testcase_34 AC 1,417 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding=utf-8 -*-
# 【考察】
# 割り算の存在しない形に式変形できれば良さそう。

import sys
sys.set_int_max_str_digits(0)

def arithmetic_progression_summary(a_1 = 1, a_n = 10, d = 1, MOD = 1):
    """等差数列の和を計算する(a_nは一般的な項数ではなくて末項を指定する)\n
       
       a_1 = 1
       a_n = 10
       d = 1
       => Σ[k=1, n=10] k => 55
    Args:
        a_1 (int): 初項。
        a_n (int): 末項。
        d (int): 公差。
    """
    a_n = a_n % MOD
    result = a_n * (a_n + 1) 
    result = result % MOD
    return result

if __name__ == "__main__":
    Q = int(input())
    for q in range(Q):
        n, m = list(map(int, input().split(" ")))
        mod = m * 2
        a = arithmetic_progression_summary(1, n, 1, mod)
        print((a // 2) % mod)
0