結果

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

ソースコード

diff #

#coding: utf-8
##yuki_5

l=int(raw_input())
n=int(raw_input())
w=map(int,raw_input().split())

w.sort()
res=0
count=0
for i in xrange(n):
 if res+w[i]<=l:
  res+=w[i]
  count+=1
 else:
  break
 
print count
0