Tasks:
 
Task DescriptionDiscussion (0)
Task :: Questionmark
You are given an expression, containing integer numbers between 0 and 999, simple mathematical operators (+, -, *, /), parentheses, and question marks (?). You can substitute a questionmark with any of the four possible operators (+, -, *, /).

For a given expression, you have to find out whether you can substitute the questionmarks with mathematical operators such that the evaluted expression equals to some given integer N.

The expressions have the following restrictions:
1. The expressions contain no more than 500 symbols.
2. The constants in the expressions have no sign, i.e. there are no negative numbers in the expressions;
3. .The maximum number of question marks in the expressions is 20.

The calculation should be performed using the following rules:
1. The operators * and / are of higher priority than the operators + and -. Parentheses may change the priorities as usually;
2. The operators +, -, *, and / are left associative, meaning that they group from left to right. If a, b and c are numbers: a*b*c = (a*b)*c, a/b/c = (a/b)/c, a/b*c = (a/b)*c, a+b+c = (a+b)+c, a-b+c = (a-b)+c, etc.
3. When dividing two integers, you should ignore the decimal fraction, for example consider the following equations: 2/5=0, 9/5=1, 100/6=16.


INPUT:
The first line contains the given expression. The second line contains the number N


OUTPUT:
Write yes or no


Input:
1?2*3+4-14
0
Output:
no


Input:
1?((2*(3*4))+(5+6))
35
Output:
yes
Submit Solution
:
:
Available Languages
Task info
Name:Questionmark
Time:10 sec.
Memory:512 MB
#Tests:25
AddedBy: admin
Task Ratings
Difficulty:

5 (1 votes)
Quality:

5 (1 votes)
Acceptance Rate
Recent Submissions
Fastest Solutions
UserTime
Solved By