Math Exam

Problem Description

After all the torture Po The Sloth put him through, Potato decided that he does not want to fight Po The Sloth anymore as he realised that his grades were dropping :((((. In fact, in his recent Mathematics mock exam, he scored a C5! Therefore, he desperately needs your help to score well in the upcoming Mathematics exam, so that his parents do not take away all of his beloved blåhajar!

There are Q questions in his Mathematics exam. Since he is in a secondary school, it isn't as simple as addition, subtraction, multiplication, and division. Rather, the operations are as follows:

1: A $ B evaluates to the arithmetic mean of A and B, to 1 decimal place.

2: A | B evaluates to the length of the hypotenuse of a right-angled triangle, to 2 decimal places, with the other 2 sides having lengths A and B

3: A ? B evaluates to the solution, to 2 decimal places, for x, where Ax2 + Bx + A = B. If there exists more than 1 solution to the equation, print the larger one. If there exists no real solutions to the problem, print "No solution!"

Subtasks:

For all testcases, -1010 ≤ A, B ≤ 1010, 1 ≤ Q ≤ 105

Q, A, and B are guaranteed to be integers.

For all operations with A | B, it is guaranteed that A, B > 0

For all operations with A ? B, it is guaranteed that A ≠ 0

Subtask 1 (15%): There will only be operations of the form A $ B

Subtask 2 (10%): There will not be operations of the form A ? B

Subtask 3 (25%): -105 ≤ A, B ≤ 105

Subtask 4 (50%): No additional constraints.

Subtask 5 (0%): Sample Testcases

Input:

The first line of input will contain one integer, Q

Q lines will follow, each containing one of the three operations as mentioned above.

Output:

For each line of query, you are to output the answer to the stated precision.

Sample Testcase

Input

6
-4 $ 10
10 $ 11
3 | 4
3 | 2
5 ? -2
3 ? 20

Output

3.0
10.5
5.00
3.61
No solution!
0.76

Submitting .cpp to 'Math Exam'


You're not logged in! Click here to login

Time Limit: 1 Seconds
Memory Limit: 1024MB
Your best score: 0
Source: RICP Diagnostic Test 2024 (Potato3218)

Subtask Score
1 15
2 10
3 25
4 50
5 0