結果

問題 No.988 N×Mマス計算(総和)
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2020-07-18 20:38:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 16,072 KB
最終ジャッジ日時 2023-09-20 12:43:50
合計ジャッジ時間 3,029 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,716 KB
testcase_01 AC 16 ms
7,880 KB
testcase_02 AC 16 ms
7,848 KB
testcase_03 AC 16 ms
7,712 KB
testcase_04 AC 16 ms
7,760 KB
testcase_05 AC 16 ms
7,840 KB
testcase_06 AC 16 ms
7,776 KB
testcase_07 AC 16 ms
7,844 KB
testcase_08 AC 17 ms
7,760 KB
testcase_09 AC 16 ms
7,824 KB
testcase_10 AC 105 ms
10,556 KB
testcase_11 AC 70 ms
15,524 KB
testcase_12 AC 193 ms
15,564 KB
testcase_13 AC 80 ms
12,920 KB
testcase_14 AC 69 ms
12,812 KB
testcase_15 AC 135 ms
10,488 KB
testcase_16 AC 190 ms
13,520 KB
testcase_17 AC 228 ms
14,500 KB
testcase_18 AC 75 ms
14,360 KB
testcase_19 AC 184 ms
14,756 KB
testcase_20 AC 278 ms
16,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, k = map(int, input().split())
tmp = list(input().split())
tmp.reverse()
op = tmp.pop()

B = [int(tmp.pop()) for i in range(m)]
A = [int(input()) for i in range(n)]

b = 0
for Bi in B:
    b += Bi
    b %= k

ans = 0
for Ai in A:
    if op == "+":
        ans += Ai * m + b
    elif op == "*":
        ans += Ai * b
    ans %= k

print(ans)
0