結果

問題 No.5 数字のブロック
ユーザー MaboyMaboy
提出日時 2021-05-28 18:19:03
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 266 bytes
コンパイル時間 15,093 ms
コンパイル使用メモリ 136,388 KB
実行使用メモリ 9,600 KB
最終ジャッジ日時 2024-04-24 21:20:09
合計ジャッジ時間 11,835 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
9,344 KB
testcase_01 AC 8 ms
9,216 KB
testcase_02 AC 9 ms
9,216 KB
testcase_03 AC 12 ms
9,512 KB
testcase_04 AC 11 ms
9,364 KB
testcase_05 AC 13 ms
9,420 KB
testcase_06 AC 12 ms
9,388 KB
testcase_07 AC 11 ms
9,500 KB
testcase_08 AC 12 ms
9,512 KB
testcase_09 AC 9 ms
9,344 KB
testcase_10 AC 13 ms
9,552 KB
testcase_11 AC 11 ms
9,600 KB
testcase_12 AC 12 ms
9,512 KB
testcase_13 AC 13 ms
9,400 KB
testcase_14 AC 9 ms
9,216 KB
testcase_15 AC 9 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,428 KB
testcase_19 AC 14 ms
9,568 KB
testcase_20 AC 9 ms
9,344 KB
testcase_21 AC 9 ms
9,216 KB
testcase_22 AC 9 ms
9,216 KB
testcase_23 AC 9 ms
9,344 KB
testcase_24 AC 9 ms
9,216 KB
testcase_25 AC 9 ms
9,216 KB
testcase_26 AC 8 ms
9,088 KB
testcase_27 AC 8 ms
9,216 KB
testcase_28 WA -
testcase_29 AC 10 ms
9,360 KB
testcase_30 AC 10 ms
9,472 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

let L = Int(readLine()!)!
let N = Int(readLine()!)!
var W = readLine()!.split(separator: " ").map{Int($0)!}
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