PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CCBCHMUOI0000040. Mã tác vụ và điều kiện bên trong (Operation Code with Inner Condition)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Mã tác vụ và điều kiện bên trong (Operation Code with Inner Condition)
Operation Code with Inner Condition
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given an operation code k and integer x, code 1 prints POS if x>0 and NONPOS otherwise; code 2 prints EVEN for an even x and ODD otherwise; code 3 prints the absolute value of x. Execute only the selected operation.
Input
One line contains integers k and x, in that order.
Output
Print exactly one keyword or integer for the chosen operation.
Subtasks
- Subtask 1 (20%): k = 1 and 0 <= x <= 100.
- Subtask 2 (30%): 1 <= k <= 2 and -100 <= x <= 100.
- Subtask 3 (50%): 1 <= k <= 3 and -100 <= x <= 100.
Examples
Example 1
Input
3 -7
Output
7
Explanation
Code 3 outputs |-7|=7, as a number only.
Example 2
Input
1 0
Output
NONPOS
Explanation
Zero is not positive, so code 1 outputs NONPOS.
Example 3
Input
2 -3
Output
ODD
Explanation
-3 has a nonzero remainder modulo 2, so it is odd.