結果

問題 No.10 +か×か
ユーザー roiti46roiti46
提出日時 2015-10-11 05:51:32
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 1,421 ms
コンパイル使用メモリ 77,664 KB
実行使用メモリ 306,796 KB
最終ジャッジ日時 2023-09-28 11:38:55
合計ジャッジ時間 6,619 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 162 ms
92,568 KB
testcase_01 AC 165 ms
92,472 KB
testcase_02 AC 162 ms
92,388 KB
testcase_03 AC 814 ms
306,796 KB
testcase_04 AC 591 ms
120,264 KB
testcase_05 WA -
testcase_06 AC 763 ms
294,780 KB
testcase_07 WA -
testcase_08 AC 279 ms
104,572 KB
testcase_09 AC 356 ms
110,268 KB
testcase_10 AC 169 ms
92,864 KB
testcase_11 AC 168 ms
92,968 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" * 50] * (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