結果

問題 No.10 +か×か
ユーザー DialBird
提出日時 2019-07-27 14:48:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
MLE  
実行時間 -
コード長 559 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 821,632 KB
最終ジャッジ日時 2024-07-02 11:01:32
合計ジャッジ時間 4,582 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 MLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    """ main """
    N = int(input())
    TOTAL = int(input())
    AS = list(map(int, input().split()))

    # 演算子文字列, result
    q = [('', AS[0])]

    for optstr, total in q:
        if len(optstr) == N-1 and total == TOTAL:
            print(optstr)
            break
        elif len(optstr) == N-1:
            continue

        cur_a = AS[len(optstr)+1]

        if total+cur_a <= TOTAL:
            q.append((optstr + '+', total+cur_a))
        if total*cur_a <= TOTAL:
            q.append((optstr + '*', total*cur_a))

main()
0