#K67262. Evaluate Mathematical Expressions

    ID: 32604 Type: Default 1000ms 256MiB

Evaluate Mathematical Expressions

Evaluate Mathematical Expressions

You are given a list of mathematical expressions as strings. Each expression consists of positive integers and the operators +, -, *, and /. The operations obey the standard precedence rules. Your task is to evaluate each expression and output the result as a float.

For example, the expression 2+3*4 should be evaluated as \(2+3\times4 = 14.0\). Similarly, 10/2-3 should result in \(\frac{10}{2}-3 = 2.0\). You can use any valid approach to parse and compute these expressions.

inputFormat

The input is read from standard input (stdin). The first line contains an integer (T) representing the number of expressions. Each of the following (T) lines contains a single valid mathematical expression.

outputFormat

For each expression, output its evaluated result as a float on a new line. Ensure that integer results are printed with a decimal point (for example, output 14.0, not 14).## sample

1
2+3*4
14.0

</p>