結果

問題 No.988 N×Mマス計算(総和)
ユーザー stngstng
提出日時 2022-08-17 10:55:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 95,176 KB
最終ジャッジ日時 2024-04-15 02:18:52
合計ジャッジ時間 2,343 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,492 KB
testcase_01 AC 35 ms
52,924 KB
testcase_02 AC 36 ms
53,200 KB
testcase_03 AC 35 ms
53,816 KB
testcase_04 AC 36 ms
52,332 KB
testcase_05 AC 36 ms
53,592 KB
testcase_06 AC 36 ms
52,896 KB
testcase_07 AC 37 ms
52,704 KB
testcase_08 AC 37 ms
52,652 KB
testcase_09 AC 36 ms
53,292 KB
testcase_10 AC 84 ms
78,864 KB
testcase_11 AC 82 ms
93,348 KB
testcase_12 AC 110 ms
94,828 KB
testcase_13 AC 81 ms
85,628 KB
testcase_14 AC 80 ms
85,408 KB
testcase_15 AC 81 ms
76,800 KB
testcase_16 AC 97 ms
86,636 KB
testcase_17 AC 105 ms
90,492 KB
testcase_18 AC 83 ms
90,564 KB
testcase_19 AC 103 ms
92,208 KB
testcase_20 AC 119 ms
95,176 KB
権限があれば一括ダウンロードができます

ソースコード

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