結果

問題 No.988 N×Mマス計算(総和)
ユーザー toshiro_yanagi
提出日時 2020-07-18 20:38:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 311 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 19,316 KB
最終ジャッジ日時 2024-07-06 08:02:41
合計ジャッジ時間 3,119 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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