Very Simple Arithmetic
Source : L | |||
Time limit : 5 sec | Memory limit : 32 M |
Submitted : 1100, Accepted : 186
Lee is a lovely 10 year old boy. Recently, his parents found out that Lee often makes stupid mistakes in simple arithmetic in the exams. Therefore, they decide to help him with his calculating ability. They assigned him a lot of exercises. However, they are tired of calculating the results, in which process they themselves might make mistakes sporadically. So they've hired you to write a program to generate correct answers for simple arithmetic problems.
Input
There are several test cases. Each test case is in one of the following formats:
a + b
a - b
a * b
a / b c
where a,b,c are integers, 0 <= a,b <= 10300, 0 <= c <= 80.
There is always a single white space between the operator and the operands, and the divisor will never be 0.
Output
For the '+', '-' and '*' operation, you should print on a single line a single number, which is the result of the operation. For the '/' operation, you should print on a single line three numbers: the first one is the integer part of the quotient, the second is the remainder, and the last one is a float number, which is the quotient rounded to c decimal places (see examples below).
Sample Input
2 + 5 3 - 4 12 * 4 10 / 3 3
Sample Output
7 -1 48 3 1 3.333