結果
問題 | No.156 キャンディー・ボックス |
ユーザー |
|
提出日時 | 2019-05-10 17:00:46 |
言語 | Swift (6.0.3) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 381 bytes |
コンパイル時間 | 1,331 ms |
コンパイル使用メモリ | 133,888 KB |
実行使用メモリ | 9,472 KB |
最終ジャッジ日時 | 2024-11-30 14:06:51 |
合計ジャッジ時間 | 2,768 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
Main.swift:7:5: warning: immutable value 'i' was never used; consider replacing with '_' or removing it for i in 0 ..< a[1] { ^ _
ソースコード
let a:[Int] = readLine()!.split(separator: " ").map{Int($0)!} var b:[Int] = readLine()!.split(separator: " ").map{Int($0)!} b.sort{$0 < $1} var box:Int = 0 for i in 0 ..< a[1] { if b[box] == 0 { box += 1 if box > a[0] { break } } b[box] -= 1 } box = 0 for i in 0 ..< a[0] { if b[i] == 0 { box += 1 } } print(box)