結果

問題 No.5 数字のブロック
ユーザー hiro_metal_corehiro_metal_core
提出日時 2017-11-03 22:11:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 262 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 9,396 KB
最終ジャッジ日時 2023-08-11 17:54:20
合計ジャッジ時間 2,156 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,900 KB
testcase_01 AC 16 ms
7,772 KB
testcase_02 AC 16 ms
7,788 KB
testcase_03 AC 23 ms
8,712 KB
testcase_04 AC 22 ms
8,428 KB
testcase_05 AC 27 ms
8,800 KB
testcase_06 AC 21 ms
8,664 KB
testcase_07 AC 20 ms
8,576 KB
testcase_08 AC 22 ms
8,876 KB
testcase_09 AC 17 ms
8,232 KB
testcase_10 AC 29 ms
9,020 KB
testcase_11 AC 20 ms
8,588 KB
testcase_12 AC 24 ms
8,788 KB
testcase_13 AC 30 ms
8,740 KB
testcase_14 AC 16 ms
7,824 KB
testcase_15 AC 16 ms
7,824 KB
testcase_16 AC 28 ms
8,760 KB
testcase_17 AC 33 ms
9,188 KB
testcase_18 AC 30 ms
9,088 KB
testcase_19 AC 33 ms
9,396 KB
testcase_20 AC 16 ms
7,796 KB
testcase_21 AC 16 ms
7,828 KB
testcase_22 AC 16 ms
7,952 KB
testcase_23 AC 16 ms
7,896 KB
testcase_24 AC 15 ms
7,816 KB
testcase_25 AC 16 ms
7,744 KB
testcase_26 AC 16 ms
7,848 KB
testcase_27 AC 16 ms
7,856 KB
testcase_28 AC 16 ms
7,952 KB
testcase_29 AC 20 ms
8,560 KB
testcase_30 AC 17 ms
8,260 KB
testcase_31 AC 16 ms
7,820 KB
testcase_32 AC 16 ms
7,896 KB
testcase_33 AC 15 ms
7,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

L = int(input())
N = int(input())

W = list(map(int, input().split()))
W.sort()
W.reverse()

sum_of_w = 0

for n in range(N):
    sum_of_w += W[n]

while(1):
    if (sum_of_w <= L):
        break
    else:
        sum_of_w -= W[0]
        W.pop(0)

print(len(W))
0