結果

問題 No.988 N×Mマス計算(総和)
ユーザー Kodai
提出日時 2020-04-14 22:47:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 772 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 52,980 KB
最終ジャッジ日時 2024-07-06 07:41:43
合計ジャッジ時間 13,364 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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