結果

問題 No.988 N×Mマス計算(総和)
ユーザー kbyskbys
提出日時 2020-03-29 01:03:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 241 ms / 2,000 ms
コード長 303 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 21,000 KB
最終ジャッジ日時 2023-09-20 12:19:16
合計ジャッジ時間 2,801 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,668 KB
testcase_01 AC 19 ms
8,632 KB
testcase_02 AC 18 ms
8,464 KB
testcase_03 AC 18 ms
8,556 KB
testcase_04 AC 18 ms
8,536 KB
testcase_05 AC 19 ms
8,496 KB
testcase_06 AC 19 ms
8,516 KB
testcase_07 AC 18 ms
8,484 KB
testcase_08 AC 19 ms
8,632 KB
testcase_09 AC 18 ms
8,528 KB
testcase_10 AC 106 ms
11,704 KB
testcase_11 AC 50 ms
19,620 KB
testcase_12 AC 171 ms
20,212 KB
testcase_13 AC 66 ms
15,196 KB
testcase_14 AC 57 ms
15,128 KB
testcase_15 AC 126 ms
10,596 KB
testcase_16 AC 164 ms
15,392 KB
testcase_17 AC 195 ms
18,044 KB
testcase_18 AC 59 ms
18,296 KB
testcase_19 AC 159 ms
18,828 KB
testcase_20 AC 241 ms
21,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#988
import collections
N,M,K = map(int,input().split())
B = input()
op = B[0]
B = list(map(int,B[1:].split()))

A = [None]*N
for i in range(N):
    A[i] = int(input())

if op == "+":
    print((N*sum(B)+M*sum(A))%K)
else:
    ans = 0
    sb = sum(B)
    for a in A:
        ans += a*sb
    print(ans%K)
0