結果

問題 No.5 数字のブロック
ユーザー Maboy
提出日時 2021-05-28 18:26:48
言語 Swift
(6.0.3)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 274 bytes
コンパイル時間 9,964 ms
コンパイル使用メモリ 134,120 KB
実行使用メモリ 9,696 KB
最終ジャッジ日時 2024-11-07 06:34:28
合計ジャッジ時間 11,439 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

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