結果

問題 No.988 N×Mマス計算(総和)
ユーザー liny_tailliny_tail
提出日時 2023-01-03 18:16:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,145 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 10,556 KB
実行使用メモリ 16,040 KB
最終ジャッジ日時 2023-08-18 00:44:29
合計ジャッジ時間 9,296 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,836 KB
testcase_01 AC 15 ms
7,784 KB
testcase_02 AC 16 ms
7,804 KB
testcase_03 AC 17 ms
7,724 KB
testcase_04 AC 16 ms
7,844 KB
testcase_05 AC 17 ms
7,840 KB
testcase_06 AC 16 ms
7,800 KB
testcase_07 AC 17 ms
7,736 KB
testcase_08 AC 15 ms
7,780 KB
testcase_09 AC 16 ms
7,732 KB
testcase_10 AC 270 ms
9,820 KB
testcase_11 AC 788 ms
15,248 KB
testcase_12 AC 931 ms
15,708 KB
testcase_13 AC 582 ms
12,320 KB
testcase_14 AC 502 ms
12,324 KB
testcase_15 AC 137 ms
8,212 KB
testcase_16 AC 697 ms
12,608 KB
testcase_17 AC 917 ms
14,104 KB
testcase_18 AC 697 ms
14,420 KB
testcase_19 AC 951 ms
14,668 KB
testcase_20 AC 1,145 ms
16,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, K = map(int, input().strip().split(' '))

tmp = input().strip().split(' ')
op = tmp[0]
B = tmp[1:]

A = 0
for i in range(N):
  A += int(input().strip())

ans = 0

for x in range(M):
  if op == '+':
    ans += (eval(str(A) + op + B[x] + '*' + str(N))) % K
  else:
    ans += (eval(str(A) + op + B[x])) % K

print(ans % K)
0