#CCBCMCHIN0000017. Dấu âm trong phép chia (Sign of Integer Division)
Dấu âm trong phép chia (Sign of Integer Division)
Sign of Integer Division
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given integers , first reject a zero divisor. Otherwise compute the C integer quotient (truncate towards zero), then classify its sign.
Input
One line with two integers .
Output
Print INVALID if . Otherwise print POS, ZERO, or NEG according to the sign of the integer quotient .
Subtasks
- Subtask 1 (20 points): . .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
-7 2
Output
NEG
Explanation
The input gives -7, 2. The divisor is 2; C-style integer division -7/2 truncates towards zero, yielding -3. Therefore the required output is ['NEG'].
Example 2
Input
1 2
Output
ZERO
Explanation
The input gives 1, 2. The divisor is 2; C-style integer division 1/2 truncates towards zero, yielding 0. Therefore the required output is ['ZERO'].
Example 3
Input
5 0
Output
INVALID
Explanation
The input gives 5, 0. The divisor is 0; division is invalid. Therefore the required output is ['INVALID'].