//No.10 +か×か //メモ // とりあえず素直に // TLEだったら計算量減らす #include #include #include #define N_MAX 50 typedef long long LL; using namespace std; int main() { const char* op = "+*"; int N, T, A[N_MAX], res; LL p; bitset<64> b; cin >> N >> T; for (int i = 0; i < N; ++i) cin >> A[i]; p = pow(2, N); //計算 for (LL i = 0; i < p; ++i) { res = A[0]; b = i; for (int j = 0; j < N - 1; ++j) { if (b[j]) res *= A[j+1]; else res += A[j+1]; if (res > T) break; } if (res == T) break; } for (int i = 0; i < N - 1; ++i) cout << op[b[i]]; cout << endl; return 0; }