結果

問題 No.987 N×Mマス計算(基本)
ユーザー MaboyMaboy
提出日時 2021-06-19 18:11:08
言語 Swift
(5.10.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 1,468 ms
コンパイル使用メモリ 135,560 KB
実行使用メモリ 8,336 KB
最終ジャッジ日時 2023-09-05 01:06:13
合計ジャッジ時間 2,541 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,160 KB
testcase_01 AC 3 ms
8,152 KB
testcase_02 AC 8 ms
8,252 KB
testcase_03 AC 4 ms
8,168 KB
testcase_04 AC 7 ms
8,192 KB
testcase_05 AC 6 ms
8,212 KB
testcase_06 AC 7 ms
8,156 KB
testcase_07 AC 5 ms
8,204 KB
testcase_08 AC 3 ms
8,244 KB
testcase_09 AC 3 ms
8,156 KB
testcase_10 AC 4 ms
8,180 KB
testcase_11 AC 8 ms
8,204 KB
testcase_12 AC 9 ms
8,336 KB
testcase_13 AC 5 ms
8,176 KB
testcase_14 AC 4 ms
8,184 KB
testcase_15 AC 5 ms
8,172 KB
testcase_16 AC 9 ms
8,244 KB
testcase_17 AC 7 ms
8,116 KB
testcase_18 AC 9 ms
8,212 KB
testcase_19 AC 13 ms
8,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let n = readLine()!.split(separator: " ").map{Int($0)!}

var L = [[Int]]()
for _ in 0...n[0]{
    L += [Array(repeating: 0, count: n[1] + 1)]
}

let m = readLine()!.split(separator: " ")
L[0][0] = m[0] == "+" ? -1 : -2
for i in 1...n[1]{
    L[0][i] = Int(m[i])!
}

var v = [Int]()
for i in 1...n[0]{
    L[i][0] += Int(readLine()!)!
    for j in 1...n[1]{
        L[i][j] = L[0][0] == -1 ? L[i][0] + L[0][j] : L[i][0] * L[0][j]
        print(L[i][j],terminator: " ")
    }
    print()
}
0