結果

問題 No.988 N×Mマス計算(総和)
ユーザー toshiro_yanagi
提出日時 2020-07-18 20:38:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,028 KB
実行使用メモリ 87,360 KB
最終ジャッジ日時 2024-07-06 08:02:52
合計ジャッジ時間 2,104 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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