#125. 判断特殊数

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

判断特殊数

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:

  1. It is a multiple of 1111.
  2. It is one more than a multiple of 1111.

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 nn.

nn

Output Format

Output true if nn is a special number; otherwise, output false.

true or false

Sample

22
true
23
true
24
false

Sample Explanation

  • Sample 1: 2222 is a multiple of 1111 (22=11×222 = 11 \times 2), so it is a special number. Output true.
  • Sample 2: 2323 is one more than a multiple of 1111 (23=11×2+123 = 11 \times 2 + 1), so it is a special number. Output true.
  • Sample 3: 2424 is neither a multiple of 1111 nor one more than a multiple of 1111 (24=11×2+224 = 11 \times 2 + 2), so it is not a special number. Output false.

Constraints

For each test case, the time limit is 11 second, and the memory limit is 10241024 KiB.