結果

問題 No.10 +か×か
ユーザー ayame_pyayame_py
提出日時 2015-10-10 16:23:40
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 746 ms / 5,000 ms
コード長 390 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 77,076 KB
実行使用メモリ 340,168 KB
最終ジャッジ日時 2024-05-08 11:47:27
合計ジャッジ時間 3,598 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,820 KB
testcase_01 AC 69 ms
75,272 KB
testcase_02 AC 70 ms
75,664 KB
testcase_03 AC 746 ms
334,412 KB
testcase_04 AC 255 ms
128,000 KB
testcase_05 AC 66 ms
75,840 KB
testcase_06 AC 746 ms
340,168 KB
testcase_07 AC 391 ms
191,944 KB
testcase_08 AC 139 ms
92,284 KB
testcase_09 AC 171 ms
103,584 KB
testcase_10 AC 78 ms
78,080 KB
testcase_11 AC 73 ms
77,440 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