結果

問題 No.5 数字のブロック
コンテスト
ユーザー simamumu
提出日時 2018-10-03 11:23:05
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 25 ms / 5,000 ms
+ 174µs
コード長 435 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 53 ms
コンパイル使用メモリ 15,360 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2026-09-25 20:18:49
合計ジャッジ時間 2,559 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

L = int(input())
N = int(input())
ww = sorted(inpl())
ww.append(INF)
tmp = 0
for i,w in enumerate(ww):
    tmp += w
    if tmp > L:
        print(i)
        break
0