結果

問題 No.5 数字のブロック
ユーザー tun
提出日時 2023-01-24 23:19:29
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 422 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2024-06-26 08:08:52
合計ジャッジ時間 2,305 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!

l = int(input())
n = int(input())
w = list(map(int, input().split())) #一列&スペースで並んだ複数のintデータを受け取る

w_sort = sorted(w)
#print(w_sort)

for i in range(0,n):
    l -=w_sort[i]
    #print(l,i) #確認


    if l == 0:
        print(i + 1)
        break
    elif l < 0:
        print(i)
        break
    if i == n -1:
        print(n)
        break

0