結果

問題 No.5 数字のブロック
コンテスト
ユーザー HIROPON87069639
提出日時 2016-02-27 16:58:24
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 200 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 77,520 KB
最終ジャッジ日時 2025-12-03 19:33:36
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# -*- coding: utf-8 -*-
L = input()
N = input()
W = map(int, raw_input().split())
W.sort()
tot = 0
cnt = 0
while tot < L and cnt < N:
    tot += W[cnt]
    cnt += 1
if L < tot:
    cnt -= 1
print cnt
0