結果

問題 No.5 数字のブロック
コンテスト
ユーザー koyopro
提出日時 2015-09-20 03:36:32
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 257 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 77,620 KB
最終ジャッジ日時 2025-12-03 17:07:34
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# -*- coding: utf-8 -*-

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

w = sorted(w)

s = 0
cnt = 0
for v in w:
    if v + s <= l:
        cnt += 1
        s += v
    else:
        break

print cnt
0