結果
問題 |
No.10 +か×か
|
ユーザー |
![]() |
提出日時 | 2021-10-26 23:22:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 551 bytes |
コンパイル時間 | 247 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 17,700 KB |
最終ジャッジ日時 | 2024-10-06 06:11:54 |
合計ジャッジ時間 | 7,058 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 TLE * 1 -- * 7 |
ソースコード
N = int(input()) T = int(input()) A = list(map(int, input().split())) tmp = [] def dfs(i, val): if i == N: if val == T: ans = "".join(tmp) print(ans.replace("0", "+").replace("1", "*")) return True return False if val + A[i] <= T: tmp.append("0") if dfs(i + 1, val + A[i]): return True tmp.pop() if val * A[i] <= T: tmp.append("1") if dfs(i + 1, val * A[i]): return True tmp.pop() return False dfs(1, A[0])