結果

問題 No.5 数字のブロック
ユーザー omicoder2017
提出日時 2017-10-13 12:46:09
言語 Python2
(2.7.18)
結果
MLE  
実行時間 -
コード長 397 bytes
コンパイル時間 801 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 818,436 KB
最終ジャッジ日時 2024-11-17 11:22:39
合計ジャッジ時間 60,554 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 TLE * 3 MLE * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding:utf-8
import itertools


L = int(raw_input())
N = int(raw_input())
W = raw_input()


listW=W.split(" ")

for i in range(1,N+1):
    result = list(itertools.combinations(listW,i))
    len_res = len(result)
    for k in range(len_res):
        int_res = map(int,result[k])
        blocks = sum(int_res)
        if L>=blocks:
            ans = i
        else:
            continue

print ans
0