Marks :10
: 6 | : 2
You are given a mathematical expression, consisting of "+", "-" and "*" operators. Answer to the expression can be correct, partially correct, or wrong.
Correct answer of the expression is obtained by applying BODMAS rule. Partially correct answers are obtained if there is a mistake in application of BODMAS rule.
You are also given an array of $$$n$$$ integers. For the integers corresponding to correct answer score 5 is given, for partially correct answer score 2 is given, and for wrong answer no score is given. Determine the sum of scores for all the $$$n$$$ integers.
The first line contains a string $$$s$$$, denoting the mathematical expression. $$$(1 \le |s| \le 30)$$$.
The second line contains an integer $$$n$$$, denoting the number of integers in the array. $$$(1 \le n \le 1000)$$$
The third line contains $$$n$$$ integers.
Print the sum of scores for all the integers.
5*4-3*2 4 -10 10 14 90
9
In the given sample case, possible answers for the expression are:
There is 1 correct answer and 2 partially correct answers in the given integers. So the answer will be 5+2+2 = 9
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.