結果
| 問題 |
No.10 +か×か
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-12 15:54:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 442 ms / 5,000 ms |
| コード長 | 488 bytes |
| コンパイル時間 | 404 ms |
| コンパイル使用メモリ | 82,124 KB |
| 実行使用メモリ | 124,928 KB |
| 最終ジャッジ日時 | 2024-09-23 04:04:43 |
| 合計ジャッジ時間 | 2,420 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
n = int(input())
x = int(input())
A = list(map(int, input().split()))
ope = []
memo = set()
def dfs(t, tot):
if t == n:
if tot == x:
print(*ope, sep="")
exit()
return
if t + tot * n in memo:
return
if tot + A[t] <= x:
ope.append("+")
dfs(t + 1, tot + A[t])
ope.pop()
if tot * A[t] <= x:
ope.append("*")
dfs(t + 1, tot * A[t])
ope.pop()
memo.add(t + tot * n)
dfs(1, A[0])