#125. 判断特殊数
判断特殊数
Check for Special Number
Background
Congcong has recently been studying number properties. He discovered that some numbers have unique characteristics and wants to write a program to identify them.
Problem Description
We define a non-negative number as "special" if it meets either of the following conditions:
- It is a multiple of .
- It is one more than a multiple of .
Given a non-negative number, return true if it is special, otherwise return false. You should use the modulo operator (%).
Input Format
The input consists of a single non-negative integer .
Output Format
Output true if is a special number; otherwise, output false.
trueorfalse
Sample
22
true
23
true
24
false
Sample Explanation
- Sample 1: is a multiple of (), so it is a special number. Output
true. - Sample 2: is one more than a multiple of (), so it is a special number. Output
true. - Sample 3: is neither a multiple of nor one more than a multiple of (), so it is not a special number. Output
false.
Constraints
For each test case, the time limit is second, and the memory limit is KiB.