結果

問題 No.988 N×Mマス計算(総和)
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2020-07-18 20:38:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 86,896 KB
実行使用メモリ 88,264 KB
最終ジャッジ日時 2023-09-20 12:44:00
合計ジャッジ時間 3,619 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,092 KB
testcase_01 AC 72 ms
71,388 KB
testcase_02 AC 72 ms
71,156 KB
testcase_03 AC 72 ms
71,352 KB
testcase_04 AC 72 ms
71,180 KB
testcase_05 AC 72 ms
71,176 KB
testcase_06 AC 72 ms
71,288 KB
testcase_07 AC 73 ms
71,268 KB
testcase_08 AC 73 ms
71,264 KB
testcase_09 AC 71 ms
71,084 KB
testcase_10 AC 114 ms
78,884 KB
testcase_11 AC 115 ms
87,248 KB
testcase_12 AC 134 ms
88,156 KB
testcase_13 AC 111 ms
82,440 KB
testcase_14 AC 109 ms
82,312 KB
testcase_15 AC 115 ms
77,648 KB
testcase_16 AC 130 ms
82,740 KB
testcase_17 AC 140 ms
85,960 KB
testcase_18 AC 111 ms
85,508 KB
testcase_19 AC 133 ms
87,116 KB
testcase_20 AC 152 ms
88,264 KB
権限があれば一括ダウンロードができます

ソースコード

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