結果

問題 No.5 数字のブロック
ユーザー splash9494splash9494
提出日時 2020-05-03 21:55:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 282 bytes
コンパイル時間 1,140 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 75,952 KB
最終ジャッジ日時 2023-09-05 06:03:13
合計ジャッジ時間 5,826 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,328 KB
testcase_01 AC 77 ms
71,228 KB
testcase_02 AC 78 ms
71,104 KB
testcase_03 AC 82 ms
75,952 KB
testcase_04 AC 81 ms
75,712 KB
testcase_05 AC 82 ms
75,864 KB
testcase_06 AC 79 ms
75,676 KB
testcase_07 AC 81 ms
75,644 KB
testcase_08 AC 82 ms
75,704 KB
testcase_09 AC 81 ms
75,652 KB
testcase_10 AC 83 ms
75,684 KB
testcase_11 AC 80 ms
75,672 KB
testcase_12 AC 82 ms
75,856 KB
testcase_13 AC 82 ms
75,700 KB
testcase_14 AC 78 ms
71,248 KB
testcase_15 AC 78 ms
71,096 KB
testcase_16 AC 82 ms
75,764 KB
testcase_17 AC 81 ms
75,856 KB
testcase_18 AC 82 ms
75,796 KB
testcase_19 AC 81 ms
75,756 KB
testcase_20 AC 78 ms
71,244 KB
testcase_21 AC 78 ms
71,180 KB
testcase_22 AC 78 ms
71,312 KB
testcase_23 AC 78 ms
71,584 KB
testcase_24 AC 78 ms
71,364 KB
testcase_25 AC 79 ms
71,352 KB
testcase_26 AC 78 ms
71,452 KB
testcase_27 AC 77 ms
71,360 KB
testcase_28 AC 78 ms
71,224 KB
testcase_29 AC 79 ms
75,700 KB
testcase_30 AC 80 ms
75,656 KB
testcase_31 AC 78 ms
71,044 KB
testcase_32 AC 77 ms
71,048 KB
testcase_33 AC 76 ms
71,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline

L = int(input())
N = int(input())
Ws = sorted(list(map(int, input().split())))
s = 0
cnt = 0
while True:
    s += Ws[cnt]
    cnt += 1
    if s >= L or cnt >= N:
        if s > L:
            cnt -= 1
        break
        

print(cnt)
0