結果

問題 No.988 N×Mマス計算(総和)
ユーザー ohanaohana
提出日時 2023-10-30 10:45:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 95,916 KB
最終ジャッジ日時 2023-10-30 10:45:49
合計ジャッジ時間 3,082 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,576 KB
testcase_01 AC 37 ms
53,576 KB
testcase_02 AC 37 ms
53,576 KB
testcase_03 AC 36 ms
53,576 KB
testcase_04 AC 36 ms
53,576 KB
testcase_05 AC 37 ms
53,576 KB
testcase_06 AC 36 ms
53,576 KB
testcase_07 AC 37 ms
53,576 KB
testcase_08 AC 37 ms
53,576 KB
testcase_09 AC 36 ms
53,576 KB
testcase_10 AC 98 ms
78,552 KB
testcase_11 AC 87 ms
92,920 KB
testcase_12 AC 116 ms
95,480 KB
testcase_13 AC 83 ms
85,496 KB
testcase_14 AC 81 ms
85,496 KB
testcase_15 AC 84 ms
76,428 KB
testcase_16 AC 103 ms
86,588 KB
testcase_17 AC 110 ms
90,612 KB
testcase_18 AC 85 ms
90,732 KB
testcase_19 AC 107 ms
92,440 KB
testcase_20 AC 125 ms
95,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w, k = map(int, input().split())


t = input().split()
ope, X = t[0], list(map(int, t[1:]))
Y = [int(input()) for i in range(h)]

sm = 0
X_pre = sum(X)
for y in Y:
    if ope == "+":
        sm = (sm + y * w + X_pre) % k
    else:
        sm = (sm + y * X_pre) % k

print(sm)
0