結果

問題 No.5 数字のブロック
ユーザー HydruHydru
提出日時 2023-01-15 14:46:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 199 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 75,836 KB
最終ジャッジ日時 2023-08-27 22:19:32
合計ジャッジ時間 4,149 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,488 KB
testcase_01 AC 70 ms
71,408 KB
testcase_02 AC 70 ms
71,256 KB
testcase_03 AC 74 ms
75,688 KB
testcase_04 AC 71 ms
75,660 KB
testcase_05 AC 75 ms
75,676 KB
testcase_06 AC 73 ms
75,628 KB
testcase_07 AC 70 ms
75,640 KB
testcase_08 AC 71 ms
75,764 KB
testcase_09 AC 72 ms
75,652 KB
testcase_10 AC 73 ms
75,592 KB
testcase_11 AC 72 ms
75,500 KB
testcase_12 AC 73 ms
75,720 KB
testcase_13 AC 76 ms
75,500 KB
testcase_14 AC 72 ms
71,312 KB
testcase_15 AC 69 ms
70,976 KB
testcase_16 AC 74 ms
75,836 KB
testcase_17 AC 74 ms
75,700 KB
testcase_18 AC 73 ms
75,636 KB
testcase_19 AC 73 ms
75,712 KB
testcase_20 AC 69 ms
70,976 KB
testcase_21 AC 69 ms
71,492 KB
testcase_22 AC 69 ms
71,112 KB
testcase_23 AC 69 ms
71,232 KB
testcase_24 AC 69 ms
71,308 KB
testcase_25 AC 70 ms
71,440 KB
testcase_26 AC 69 ms
71,440 KB
testcase_27 AC 68 ms
71,244 KB
testcase_28 AC 69 ms
71,288 KB
testcase_29 AC 72 ms
75,628 KB
testcase_30 AC 71 ms
75,504 KB
testcase_31 AC 69 ms
71,188 KB
testcase_32 AC 70 ms
71,112 KB
testcase_33 AC 69 ms
71,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

W.sort()
cnt=0
width=0

for i in range(n):
    if width+W[i]<=l:
        cnt+=1
        width+=W[i]
    else:
        break

print(cnt)
0