結果

問題 No.5 数字のブロック
ユーザー oz4point5oz4point5
提出日時 2019-03-30 19:44:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 500 ms / 5,000 ms
コード長 281 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 9,444 KB
最終ジャッジ日時 2023-08-11 19:03:02
合計ジャッジ時間 5,754 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,840 KB
testcase_01 AC 15 ms
7,908 KB
testcase_02 AC 15 ms
7,904 KB
testcase_03 AC 204 ms
8,892 KB
testcase_04 AC 139 ms
8,584 KB
testcase_05 AC 315 ms
9,136 KB
testcase_06 AC 144 ms
8,892 KB
testcase_07 AC 104 ms
8,708 KB
testcase_08 AC 181 ms
9,008 KB
testcase_09 AC 37 ms
8,320 KB
testcase_10 AC 375 ms
9,336 KB
testcase_11 AC 99 ms
8,676 KB
testcase_12 AC 217 ms
8,948 KB
testcase_13 AC 306 ms
8,992 KB
testcase_14 AC 16 ms
7,836 KB
testcase_15 AC 16 ms
7,880 KB
testcase_16 AC 334 ms
9,200 KB
testcase_17 AC 455 ms
9,152 KB
testcase_18 AC 396 ms
9,168 KB
testcase_19 AC 500 ms
9,444 KB
testcase_20 AC 15 ms
7,844 KB
testcase_21 AC 15 ms
7,868 KB
testcase_22 AC 15 ms
7,852 KB
testcase_23 AC 15 ms
7,972 KB
testcase_24 AC 16 ms
7,864 KB
testcase_25 AC 16 ms
7,820 KB
testcase_26 AC 15 ms
7,908 KB
testcase_27 AC 15 ms
7,872 KB
testcase_28 AC 15 ms
7,796 KB
testcase_29 AC 139 ms
8,660 KB
testcase_30 AC 43 ms
8,236 KB
testcase_31 AC 15 ms
7,824 KB
testcase_32 AC 15 ms
7,908 KB
testcase_33 AC 15 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

l = int(input())
n = int(input())
w = list(map(int,input().split()))

w.sort()
g = [0] * n

for i in range(n):
    g[i] = sum(w[:(i+1)])

answer = 0

for i in range(n):
    if g[i] > l:
        answer = i
        break
else:
    answer = n

print(answer)
0