結果

問題 No.10 +か×か
ユーザー ayame_pyayame_py
提出日時 2015-10-10 16:23:40
言語 PyPy2
(7.3.13)
結果
AC  
実行時間 809 ms / 5,000 ms
コード長 390 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 77,996 KB
実行使用メモリ 341,532 KB
最終ジャッジ日時 2023-08-21 06:14:24
合計ジャッジ時間 4,276 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
76,524 KB
testcase_01 AC 72 ms
76,696 KB
testcase_02 AC 72 ms
76,452 KB
testcase_03 AC 802 ms
335,572 KB
testcase_04 AC 285 ms
129,784 KB
testcase_05 AC 71 ms
76,548 KB
testcase_06 AC 809 ms
341,532 KB
testcase_07 AC 429 ms
192,488 KB
testcase_08 AC 151 ms
93,752 KB
testcase_09 AC 184 ms
105,752 KB
testcase_10 AC 82 ms
79,200 KB
testcase_11 AC 80 ms
79,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(raw_input())
T = int(raw_input())
A = map(int, raw_input().split())
dp = [[1 for _ in range(T+1)] for _ in range(N)]
dp[0][A[0]]=''
for i in range(1, N):
	for t in range(1,T+1):
		if t-A[i]>0 and dp[i-1][t-A[i]]!=1:
			s = dp[i-1][t-A[i]]+'+'
			dp[i][t]=max(dp[i][t],s)
		if t%A[i]==0 and dp[i-1][t/A[i]]!=1:
			s = dp[i-1][t/A[i]]+'*'
			dp[i][t]=max(dp[i][t],s)
print dp[N-1][T]
0