結果

問題 No.988 N×Mマス計算(総和)
ユーザー ryo_nryo_n
提出日時 2020-02-14 21:34:26
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 317 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,564 KB
実行使用メモリ 23,988 KB
最終ジャッジ日時 2023-09-20 11:34:32
合計ジャッジ時間 2,815 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,828 KB
testcase_01 AC 16 ms
7,884 KB
testcase_02 AC 16 ms
7,884 KB
testcase_03 AC 16 ms
7,840 KB
testcase_04 AC 16 ms
7,836 KB
testcase_05 AC 15 ms
7,980 KB
testcase_06 AC 16 ms
7,804 KB
testcase_07 AC 16 ms
7,900 KB
testcase_08 AC 16 ms
7,932 KB
testcase_09 AC 16 ms
7,808 KB
testcase_10 AC 102 ms
12,140 KB
testcase_11 AC 54 ms
18,996 KB
testcase_12 AC 178 ms
21,204 KB
testcase_13 AC 69 ms
15,360 KB
testcase_14 AC 58 ms
14,976 KB
testcase_15 AC 136 ms
10,812 KB
testcase_16 AC 182 ms
17,392 KB
testcase_17 AC 215 ms
20,296 KB
testcase_18 AC 60 ms
17,648 KB
testcase_19 AC 174 ms
20,152 KB
testcase_20 AC 268 ms
23,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, K = [int(x) for x in input().split()]
C = [x for x in input().split()]
B = [int(x) for x in C[1:]]
A = [int(input()) for _ in range(N)]

ans = 0
bs = sum(B)
for j in range(N):
    if C[0] == '+':
        ans += A[j] * M + bs
        ans %= K
    else:
        ans += A[j] * bs
        ans %= K

print(ans % K)

0