結果
| 問題 |
No.10 +か×か
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-05 00:18:12 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 448 bytes |
| コンパイル時間 | 94 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 17,568 KB |
| 最終ジャッジ日時 | 2024-07-01 05:19:35 |
| 合計ジャッジ時間 | 8,512 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 TLE * 1 -- * 4 |
ソースコード
from collections import deque
from functools import lru_cache
N = int(input())
T = int(input())
A = tuple(map(int, input().split()))
stk = deque()
@lru_cache
def rec(i, x):
if i == N and x == T:
res = ''.join(map(str, stk))
print(res)
exit()
elif i == N or x > T:
return
stk.append('+')
rec(i + 1, x + A[i])
stk.pop()
stk.append('*')
rec(i + 1, x * A[i])
stk.pop()
rec(1, A[0])