#CCBCHMUOI0000023. Máy tính bốn phép (Four-Operation Calculator)
Máy tính bốn phép (Four-Operation Calculator)
Four-Operation Calculator
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
A calculator receives integers a and b and an operator +, -, * or /. Compute the indicated integer operation. Division by zero prints ERROR. Integer division truncates toward zero, for example -7/2 = -3.
Input
One line contains integer a, an operator character op, then integer b.
Output
Print the integer operation result; print ERROR for division by zero.
Subtasks
- Subtask 1 (20%): 0 <= a,b <= 10 and op is + or -.
- Subtask 2 (30%): -100 <= a,b <= 100 and op is +, - or *.
- Subtask 3 (50%): -10^6 <= a,b <= 10^6 and op is +, -, * or /.
Examples
Example 1
Input
7 / 2
Output
3
Explanation
Integer division of 7 by 2 yields 3.
Example 2
Input
7 / 0
Output
ERROR
Explanation
The divisor is zero, so division is not evaluated.