結果

問題 No.10 +か×か
ユーザー DialBirdDialBird
提出日時 2019-07-27 14:48:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 559 bytes
コンパイル時間 2,091 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 813,468 KB
最終ジャッジ日時 2023-09-15 06:17:16
合計ジャッジ時間 95,888 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,952 KB
testcase_01 AC 16 ms
7,824 KB
testcase_02 AC 16 ms
7,780 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

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