結果

問題 No.10 +か×か
コンテスト
ユーザー roiti46
提出日時 2015-04-16 01:11:11
言語 PyPy2
(7.3.15)
結果
MLE  
実行時間 -
コード長 372 bytes
記録
コンパイル時間 249 ms
コンパイル使用メモリ 77,276 KB
最終ジャッジ日時 2025-12-03 14:39:48
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 MLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(raw_input())
T = int(raw_input())
a = map(int, raw_input().split())
dp = [[a[0],""]]

for ai in a[1:]:
    ndp = []
    for s, e in dp:
        if s+ai <= T: ndp.append([s+ai, e+"0"])
        if s*ai <= T: ndp.append([s*ai, e+"1"])
    dp = ndp
    
ans = "1"*100
for s, e in dp:
    if s == T:
        ans = min(ans, e)
print ans.replace("1","*").replace("0","+")
0