#128. 判断数字是否接近20的倍数

    ID: 128 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatLogic-1gesp1条件结构数学基础

判断数字是否接近20的倍数

Judge if Close to a Multiple of 20

Background

Congcong is learning about number properties. He wants to write a program to determine if a given non-negative number satisfies a special condition.

Problem Description

Given a non-negative integer nn, return true if nn is 1 or 2 less than a multiple of 20; otherwise, return false.

For example:

  • For n=38n=38, it is 2 less than 2×20=402 \times 20 = 40, so return true.
  • For n=39n=39, it is 1 less than 2×20=402 \times 20 = 40, so return true.
  • For n=40n=40, it is exactly a multiple of 20, which does not satisfy the condition, so return false.

Input Format

Input a non-negative integer nn.

nn

Output Format

Output true if the condition is met, otherwise output false.

true or false

Sample

18
true
19
true
20
false

Sample Explanation

  • For n=18n=18, it is 2 less than 1×20=201 \times 20 = 20, so return true.
  • For n=19n=19, it is 1 less than 1×20=201 \times 20 = 20, so return true.
  • For n=20n=20, it is exactly a multiple of 20, which does not satisfy the condition, so return false.

Constraints

Time limit: 1 second per test case. Memory limit: 1024 KiB per test case. nn is a non-negative integer.