結果

問題 No.5 数字のブロック
ユーザー PycysAPycysA
提出日時 2019-08-18 03:41:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 17,300 KB
最終ジャッジ日時 2024-04-08 16:03:44
合計ジャッジ時間 7,098 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,112 KB
testcase_01 AC 34 ms
10,112 KB
testcase_02 WA -
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

l = int(input())
n = int(input())
w = [int(i) for i in input().split()]
x = sum(w)//2
w = [i for i in w if i<x]
wl = len(w)
max_num = 0
r_num = 2**wl
for i in range(1,r_num+1):
    s = bin(i)[2:].zfill(wl)
    k_num = 0
    pr_num = 0
    for j, f_num in zip(list(s), range(wl)):
        if j == "1":
            k_num += w[f_num]
            pr_num += 1
        if k_num > l:
            break
    if k_num <= l and max_num < pr_num:
        max_num = pr_num
print(max_num)
0