結果
| 問題 | No.10 +か×か |
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2020-09-03 09:02:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 570 ms / 5,000 ms |
| コード長 | 565 bytes |
| 記録 | |
| コンパイル時間 | 173 ms |
| コンパイル使用メモリ | 82,260 KB |
| 実行使用メモリ | 308,884 KB |
| 最終ジャッジ日時 | 2025-12-06 14:56:41 |
| 合計ジャッジ時間 | 2,727 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
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