結果

問題 No.988 N×Mマス計算(総和)
ユーザー stng
提出日時 2022-08-17 10:54:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 94,848 KB
最終ジャッジ日時 2024-10-04 10:32:29
合計ジャッジ時間 2,981 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 9 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,k = map(int,input().split())
opb = input().split()
op = opb[0]
b = []
for i in range(1,m+1):
    b.append(int(opb[i]))

a = [int(input()) for i in range(n)]

ans = 0

smb = sum(b)
sma = sum(a)

for i in range(n):
    if op == "+":
        ans += a[i]*m
    else:
        ans += a[i]*smb
    ans %= k

for i in range(m):
    if op == "+":
        ans += b[i]*n
    #else:
    #    ans += b[i]*sma
    #ans %= k

print(ans)
0