結果

問題 No.143 豆
ユーザー MaboyMaboy
提出日時 2021-06-16 13:18:23
言語 Swift
(5.10.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 248 bytes
コンパイル時間 5,475 ms
コンパイル使用メモリ 125,484 KB
実行使用メモリ 8,128 KB
最終ジャッジ日時 2023-08-28 21:08:38
合計ジャッジ時間 7,201 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,068 KB
testcase_01 AC 3 ms
8,024 KB
testcase_02 AC 3 ms
8,072 KB
testcase_03 AC 4 ms
8,092 KB
testcase_04 AC 3 ms
8,108 KB
testcase_05 AC 4 ms
8,128 KB
testcase_06 AC 4 ms
7,996 KB
testcase_07 AC 4 ms
8,124 KB
testcase_08 AC 3 ms
7,996 KB
testcase_09 AC 4 ms
8,028 KB
testcase_10 AC 3 ms
8,076 KB
testcase_11 AC 3 ms
8,092 KB
testcase_12 AC 3 ms
8,052 KB
testcase_13 AC 3 ms
8,028 KB
testcase_14 AC 3 ms
8,076 KB
testcase_15 AC 4 ms
8,028 KB
testcase_16 AC 3 ms
8,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let inpA = readLine()!
let inpB = readLine()!

let inpAs = inpA.split(separator: " ").map{Int($0)!}
let ages = inpB.split(separator: " ").map{Int($0)!}.reduce(0, +)

let beans = inpAs[0] * inpAs[1]
let rem = beans - ages

print(rem < 0 ? -1 : rem)
0