結果

問題 No.5 数字のブロック
ユーザー a_ten
提出日時 2016-03-08 21:18:37
言語 Python2
(2.7.18)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 232 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-11-18 08:19:08
合計ジャッジ時間 1,895 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding:utf-8

from heapq import heapify,heappop

L=input()
N=input()
W_str=raw_input().split()
W=[int(i) for i in W_str]

heapify(W)

cnt=0
while True:
	if W:
		L-=heappop(W)
		if L < 0:
			break
		cnt+=1
	else:
		break
	
print cnt
0