結果

問題 No.987 N×Mマス計算(基本)
ユーザー user_azmuser_azm
提出日時 2020-03-07 22:43:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 950 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-23 14:20:13
合計ジャッジ時間 1,530 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 35 ms
10,880 KB
testcase_03 AC 32 ms
10,752 KB
testcase_04 AC 34 ms
11,008 KB
testcase_05 AC 32 ms
10,880 KB
testcase_06 AC 35 ms
10,880 KB
testcase_07 AC 32 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 30 ms
10,752 KB
testcase_10 AC 30 ms
10,752 KB
testcase_11 AC 35 ms
10,880 KB
testcase_12 AC 36 ms
11,008 KB
testcase_13 AC 32 ms
10,752 KB
testcase_14 AC 30 ms
10,880 KB
testcase_15 AC 32 ms
10,752 KB
testcase_16 AC 35 ms
11,008 KB
testcase_17 AC 35 ms
10,880 KB
testcase_18 AC 36 ms
11,008 KB
testcase_19 AC 40 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]

N = Line[0]+1
M = Line[1]+1

sheet = [[0 for i in range(M)] for j in range(N)]

# print(sheet)

input_line = input()
Line = input_line.split()

if "+" == Line[0]:
    Line[0] = "0"
elif "*" == Line[0]:
    Line[0] = "1"

Line = [int(s) for s in Line]

a = 0
for i in Line:
    sheet[0][a] = i
    a += 1

for i in range(N-1):
    input_line = input()
    sheet[i+1][0] = int(input_line)

if sheet[0][0] == 0:
    for b in range(N):
        for c in range(M):
            sheet[b][c] = sheet[b][0] + sheet[0][c]
elif sheet[0][0] == 1:
    for b in range(N):
        for c in range(M):
            sheet[b][c] = sheet[b][0] * sheet[0][c]

# print(sheet)

for i in range(N-1):
    answer = ""
    # print(sheet[i+1])
    for b in range(M-1):
        # print(sheet[i+1][b+1])
        answer += " "+str(sheet[i+1][b+1])
    print(answer[1:])
0