結果

問題 No.5 数字のブロック
ユーザー ayame_py
提出日時 2015-10-06 00:58:14
言語 Python2
(2.7.18)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 190 bytes
コンパイル時間 43 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2024-11-18 07:37:56
合計ジャッジ時間 1,277 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
L = int(raw_input())
N = int(raw_input())
W = map(int, raw_input().split())
W.sort()
res = 0
sumw = 0
for i in W:
	if sumw+i <= L:
		sumw+=i
		res+=1
	else:
		break
print res
0