結果

問題 No.5 数字のブロック
ユーザー 👑 KazunKazun
提出日時 2020-05-31 03:43:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 198 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,904 KB
実行使用メモリ 61,820 KB
最終ジャッジ日時 2024-04-27 15:19:28
合計ジャッジ時間 2,740 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
52,400 KB
testcase_01 AC 39 ms
52,480 KB
testcase_02 AC 41 ms
52,580 KB
testcase_03 AC 48 ms
59,556 KB
testcase_04 AC 45 ms
60,200 KB
testcase_05 AC 50 ms
61,248 KB
testcase_06 AC 45 ms
59,288 KB
testcase_07 AC 47 ms
59,364 KB
testcase_08 AC 51 ms
60,400 KB
testcase_09 AC 44 ms
59,020 KB
testcase_10 AC 46 ms
60,048 KB
testcase_11 AC 45 ms
60,068 KB
testcase_12 AC 46 ms
60,252 KB
testcase_13 AC 46 ms
60,676 KB
testcase_14 AC 40 ms
53,068 KB
testcase_15 AC 40 ms
52,484 KB
testcase_16 AC 45 ms
61,028 KB
testcase_17 AC 44 ms
61,560 KB
testcase_18 AC 46 ms
61,820 KB
testcase_19 AC 46 ms
61,224 KB
testcase_20 AC 39 ms
52,072 KB
testcase_21 AC 40 ms
53,684 KB
testcase_22 AC 39 ms
52,180 KB
testcase_23 AC 40 ms
51,908 KB
testcase_24 AC 42 ms
52,112 KB
testcase_25 AC 40 ms
53,180 KB
testcase_26 AC 40 ms
52,564 KB
testcase_27 AC 40 ms
52,804 KB
testcase_28 AC 40 ms
52,540 KB
testcase_29 AC 45 ms
59,420 KB
testcase_30 AC 45 ms
58,696 KB
testcase_31 AC 40 ms
52,280 KB
testcase_32 AC 39 ms
52,248 KB
testcase_33 AC 41 ms
52,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

if sum(W)<=L:
    print(N)
else:
    W.sort()
    X=0
    k=0
    while (X<=L) and (k<N):
        X+=W[k]
        k+=1
    print(k-1)
0