結果

問題 No.5 数字のブロック
ユーザー MaboyMaboy
提出日時 2021-05-28 18:26:48
言語 Swift
(5.10.0)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 274 bytes
コンパイル時間 7,488 ms
コンパイル使用メモリ 133,556 KB
実行使用メモリ 9,600 KB
最終ジャッジ日時 2024-04-24 21:27:17
合計ジャッジ時間 3,943 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
9,088 KB
testcase_01 AC 9 ms
9,216 KB
testcase_02 AC 9 ms
9,216 KB
testcase_03 AC 12 ms
9,516 KB
testcase_04 AC 11 ms
9,364 KB
testcase_05 AC 13 ms
9,448 KB
testcase_06 AC 11 ms
9,380 KB
testcase_07 AC 11 ms
9,368 KB
testcase_08 AC 11 ms
9,384 KB
testcase_09 AC 10 ms
9,472 KB
testcase_10 AC 13 ms
9,420 KB
testcase_11 AC 11 ms
9,600 KB
testcase_12 AC 12 ms
9,388 KB
testcase_13 AC 13 ms
9,528 KB
testcase_14 AC 9 ms
9,216 KB
testcase_15 AC 8 ms
9,344 KB
testcase_16 AC 13 ms
9,548 KB
testcase_17 AC 13 ms
9,436 KB
testcase_18 AC 13 ms
9,556 KB
testcase_19 AC 14 ms
9,564 KB
testcase_20 AC 9 ms
9,088 KB
testcase_21 AC 9 ms
9,088 KB
testcase_22 AC 8 ms
9,216 KB
testcase_23 AC 9 ms
9,216 KB
testcase_24 AC 8 ms
9,216 KB
testcase_25 AC 9 ms
9,216 KB
testcase_26 AC 9 ms
9,216 KB
testcase_27 AC 8 ms
9,216 KB
testcase_28 AC 9 ms
9,216 KB
testcase_29 AC 11 ms
9,488 KB
testcase_30 AC 10 ms
9,344 KB
testcase_31 AC 9 ms
9,216 KB
testcase_32 AC 9 ms
9,216 KB
testcase_33 AC 9 ms
9,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let L = Int(readLine()!)!
let N = Int(readLine()!)!
var W = readLine()!.split(separator: " ").map{Int($0)!}
W += [L]
W.sort()
var sum :Int = 0
var count :Int = 0
while sum < L{
    sum = sum + W[count]
    count = count + 1
}
if sum > L{
    count = count - 1
}
print(count)
0