結果

問題 No.5 数字のブロック
ユーザー kazu116kazu116
提出日時 2019-05-10 12:37:37
言語 Swift
(5.10.0)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 404 bytes
コンパイル時間 2,810 ms
コンパイル使用メモリ 132,128 KB
実行使用メモリ 8,112 KB
最終ジャッジ日時 2023-08-20 12:23:25
合計ジャッジ時間 5,068 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,740 KB
testcase_01 AC 3 ms
7,872 KB
testcase_02 AC 4 ms
7,816 KB
testcase_03 AC 10 ms
8,096 KB
testcase_04 AC 8 ms
8,012 KB
testcase_05 AC 12 ms
8,008 KB
testcase_06 AC 8 ms
8,056 KB
testcase_07 AC 8 ms
8,076 KB
testcase_08 AC 9 ms
7,928 KB
testcase_09 AC 5 ms
8,036 KB
testcase_10 AC 12 ms
8,108 KB
testcase_11 AC 7 ms
7,972 KB
testcase_12 AC 10 ms
7,916 KB
testcase_13 AC 12 ms
8,112 KB
testcase_14 AC 4 ms
7,944 KB
testcase_15 AC 3 ms
7,860 KB
testcase_16 AC 12 ms
8,036 KB
testcase_17 AC 13 ms
8,092 KB
testcase_18 AC 12 ms
8,080 KB
testcase_19 AC 14 ms
8,092 KB
testcase_20 AC 3 ms
7,828 KB
testcase_21 AC 3 ms
7,816 KB
testcase_22 AC 3 ms
7,896 KB
testcase_23 AC 3 ms
7,924 KB
testcase_24 AC 4 ms
7,768 KB
testcase_25 AC 4 ms
7,800 KB
testcase_26 AC 3 ms
7,740 KB
testcase_27 AC 4 ms
7,860 KB
testcase_28 AC 3 ms
7,868 KB
testcase_29 AC 7 ms
7,960 KB
testcase_30 AC 5 ms
7,960 KB
testcase_31 AC 3 ms
7,860 KB
testcase_32 AC 4 ms
7,932 KB
testcase_33 AC 3 ms
7,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let boxWidth:[Int] = readLine()!.split(separator: " ").map{Int($0)!}
let blockSize:[Int] = readLine()!.split(separator: " ").map{Int($0)!}
var blockWidth:[Int] = readLine()!.split(separator: " ").map{Int($0)!}

blockWidth.sort(){$0 < $1}

var sum:Int = 0
var count:Int = 0
for i in 0..<blockSize[0] {
    sum += blockWidth[i]
    if(sum > boxWidth[0]) {
        break
    }
    count += 1
}

print(count)
0