結果

問題 No.10 +か×か
ユーザー roiti46roiti46
提出日時 2015-10-11 05:50:53
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 546 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 6,608 KB
実行使用メモリ 266,988 KB
最終ジャッジ日時 2023-09-28 11:38:44
合計ジャッジ時間 21,576 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
7,776 KB
testcase_01 AC 25 ms
7,844 KB
testcase_02 AC 26 ms
7,908 KB
testcase_03 AC 4,880 ms
266,988 KB
testcase_04 AC 4,000 ms
35,392 KB
testcase_05 WA -
testcase_06 AC 4,816 ms
265,220 KB
testcase_07 WA -
testcase_08 AC 900 ms
24,876 KB
testcase_09 AC 1,566 ms
27,576 KB
testcase_10 AC 42 ms
8,096 KB
testcase_11 AC 29 ms
7,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N = int(raw_input())
T = int(raw_input())
A = map(int, raw_input().split())
dp = [["b" * 100] * (T + 1) for i in xrange(N)]
dp[0][A[0]] = ""

for i in xrange(1, N):
    for j in xrange(T):
        if j + A[i] <= T:
            dp[i][j + A[i]] = min(dp[i][j + A[i]], dp[i - 1][j] + "a")
        if j * A[i] <= T:
            dp[i][j * A[i]] = min(dp[i][j * A[i]], dp[i - 1][j] + "b")
print dp[N - 1][T].replace("a", "+").replace("b", "*")
0