結果

問題 No.988 N×Mマス計算(総和)
ユーザー KodaiKodai
提出日時 2020-04-14 22:47:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 346 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 42,252 KB
最終ジャッジ日時 2023-09-20 12:21:39
合計ジャッジ時間 5,364 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
29,620 KB
testcase_01 AC 134 ms
29,620 KB
testcase_02 AC 134 ms
29,688 KB
testcase_03 AC 134 ms
29,668 KB
testcase_04 AC 134 ms
29,668 KB
testcase_05 AC 133 ms
29,660 KB
testcase_06 AC 131 ms
29,544 KB
testcase_07 AC 133 ms
29,576 KB
testcase_08 AC 135 ms
29,636 KB
testcase_09 AC 134 ms
29,572 KB
testcase_10 AC 203 ms
32,872 KB
testcase_11 AC 172 ms
40,304 KB
testcase_12 AC 276 ms
40,896 KB
testcase_13 AC 185 ms
36,348 KB
testcase_14 AC 175 ms
36,040 KB
testcase_15 AC 235 ms
32,524 KB
testcase_16 AC 278 ms
37,088 KB
testcase_17 AC 303 ms
39,424 KB
testcase_18 AC 177 ms
38,856 KB
testcase_19 AC 276 ms
39,640 KB
testcase_20 AC 346 ms
42,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
N, M, K = list(map(int, input().split()))
op, *B_list = input().split()
B_array = np.array(list(map(int, B_list)))

sum = 0
if op == "+":
    sum += np.sum((B_array*(N % K)) % K)
    A_array = np.array([int(input()) for i in range(N)])
    sum += np.sum((A_array*(M % K)) % K)
else:
    A_array = np.array([int(input()) for i in range(N)])
    temp_sum = np.sum(A_array) % K
    sum += np.sum((B_array*temp_sum) % K)

print(sum % K)
0