题目描述
Problem Description
A simple calculator that supports four operations: +, -, *, /. Only integer inputs and outputs are considered, and the data and operation results will not exceed the range representable by int. However:
-
If the divisor is zero, the output should be:
Divided by zero!. -
If an invalid operator (not one of
+,-,*,/) is encountered, the output should be:Invalid operator!. -
The division operator represents integer division, with the result rounded towards zero.
Input Format
The input consists of a single line with three parameters, where the first two parameters are integers and the third parameter is an operator (+, -, *, /).
Output Format
The output consists of a single line, which is an integer representing the operation result. However:
-
If the divisor is zero, the output should be:
Divided by zero!. -
If an invalid operator (not one of
+,-,*,/) is encountered, the output should be:Invalid operator!.
Sample Input and Output
Sample Input #1
1 2 +
Sample Output #1
3
Sample Input #2
2 4 *
Sample Output #2
8
Sample Input #3
5 0 /
Sample Output #3
Divided by zero!
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分