結果

問題 No.5 数字のブロック
ユーザー Maboy
提出日時 2021-05-28 18:19:03
言語 Swift
(6.0.3)
結果
WA  
実行時間 -
コード長 266 bytes
コンパイル時間 11,944 ms
コンパイル使用メモリ 135,716 KB
実行使用メモリ 9,600 KB
最終ジャッジ日時 2024-11-07 06:25:52
合計ジャッジ時間 4,060 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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