結果
| 問題 |
No.10 +か×か
|
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2020-09-03 09:02:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 588 ms / 5,000 ms |
| コード長 | 565 bytes |
| コンパイル時間 | 210 ms |
| コンパイル使用メモリ | 82,120 KB |
| 実行使用メモリ | 308,556 KB |
| 最終ジャッジ日時 | 2024-12-14 15:46:26 |
| 合計ジャッジ時間 | 2,820 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
n = int(input())
tot = int(input())
a = list(map(int, input().split()))
dp = [None] * (tot + 1)
dp[a[0]] = ''
for x in a[1:]:
ndp = [None] * (tot + 1)
for i in range(tot + 1):
if dp[i] is not None:
if i + x <= tot:
t = dp[i] + '+'
if ndp[i + x] is None or t < ndp[i + x]:
ndp[i + x] = t
if i * x <= tot:
t = dp[i] + ','
if ndp[i * x] is None or t < ndp[i * x]:
ndp[i * x] = t
dp = ndp
print(dp[tot].replace(',', '*'))
Kude