CF1183A.Nearest Interesting Number

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Polycarp knows that if the sum of the digits of a number is divisible by 33, then the number itself is divisible by 33. He assumes that the numbers, the sum of the digits of which is divisible by 44, are also somewhat interesting. Thus, he considers a positive integer nn interesting if its sum of digits is divisible by 44.

Help Polycarp find the nearest larger or equal interesting number for the given number aa. That is, find the interesting number nn such that n≥an \ge a and nn is minimal.

Polycarp 知道:如果一个数的各位数字之和能被 33 整除,那么该数本身也能被 33 整除。他进一步认为,各位数字之和能被 44 整除的数也具有某种趣味性。因此,他将一个正整数 nn 称为“有趣的数”,当且仅当 nn 的各位数字之和能被 44 整除。

请帮助 Polycarp 找到给定数 aa 的最近的、不小于 aa 的“有趣的数”。即:找出满足 n≥an \ge a 且最小的“有趣的数” nn。

输入格式

The only line in the input contains an integer aa (1≤a≤10001 \le a \le 1000).

输入仅包含一行,其中有一个整数 aa(1≤a≤10001 \le a \le 1000)。

输出格式

Print the nearest greater or equal interesting number for the given number aa. In other words, print the interesting number nn such that n≥an \ge a and nn is minimal.

输出给定数字 aa 的最近的、大于等于 aa 的“有趣数”。换言之,输出满足 n≥an \ge a 且最小的“有趣数” nn。

输入输出样例

  • 输入#1

    432

    输出#1

    435
  • 输入#2

    99

    输出#2

    103
  • 输入#3

    237

    输出#3

    237
  • 输入#4

    42

    输出#4

    44

输入解题思路,AI测评打分。不知道怎么写?

首页