結果

問題 No.10 +か×か
ユーザー ayame_pyayame_py
提出日時 2015-10-10 16:22:16
言語 Python2
(2.7.18)
結果
AC  
実行時間 4,508 ms / 5,000 ms
コード長 390 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 6,684 KB
実行使用メモリ 269,096 KB
最終ジャッジ日時 2023-08-21 06:14:51
合計ジャッジ時間 15,594 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,856 KB
testcase_01 AC 11 ms
5,932 KB
testcase_02 AC 11 ms
5,888 KB
testcase_03 AC 4,508 ms
269,096 KB
testcase_04 AC 1,749 ms
36,124 KB
testcase_05 AC 11 ms
5,868 KB
testcase_06 AC 4,434 ms
267,004 KB
testcase_07 AC 2,600 ms
100,016 KB
testcase_08 AC 545 ms
24,592 KB
testcase_09 AC 835 ms
28,972 KB
testcase_10 AC 19 ms
6,048 KB
testcase_11 AC 12 ms
5,980 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