CF681B.Economy Game

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Kolya is developing an economy simulator game. His most favourite part of the development process is in-game testing. Once he was entertained by the testing so much, that he found out his game-coin score become equal to 0.

Kolya remembers that at the beginning of the game his game-coin score was equal to n and that he have bought only some houses (for 1 234 567 game-coins each), cars (for 123 456 game-coins each) and computers (for 1 234 game-coins each).

Kolya is now interested, whether he could have spent all of his initial n game-coins buying only houses, cars and computers or there is a bug in the game. Formally, is there a triple of non-negative integers a, b and c such that a × 1 234 567 + b × 123 456 + c × 1 234 = n?

Please help Kolya answer this question.

科里亚正在开发一款经济模拟游戏。他最喜爱的开发环节是游戏内测试。有一次,他沉迷于测试,以至于发现自己的游戏金币数量变为 0。

科里亚记得,游戏开始时他的游戏金币数量为 nn,并且他只购买了若干栋房屋(每栋售价 1 234 5671\,234\,567 枚游戏金币)、若干辆汽车(每辆售价 123 456123\,456 枚游戏金币)以及若干台电脑(每台售价 1 2341\,234 枚游戏金币)。

科里亚现在想知道:他是否有可能恰好花光初始的 nn 枚游戏金币,仅通过购买房屋、汽车和电脑来实现?还是说游戏中存在一个漏洞?形式化地说,是否存在一组非负整数 aa、bb 和 cc,使得

a×1 234 567+b×123 456+c×1 234=n?a \times 1\,234\,567 + b \times 123\,456 + c \times 1\,234 = n \quad ?

请帮助科里亚回答这个问题。

输入格式

The first line of the input contains a single integer n (1 ≤ n ≤ 109) — Kolya's initial game-coin score.

输入的第一行包含一个整数 nn(1 ≤ n ≤ 1091 \leq n \leq 10^9)—— Kolya 初始的游戏币得分。

输出格式

Print "YES" (without quotes) if it's possible that Kolya spent all of his initial n coins buying only houses, cars and computers. Otherwise print "NO" (without quotes).

如果科里亚有可能仅用初始的 nn 枚硬币购买房屋、汽车和计算机,并恰好花光所有硬币,则输出 "YES"(不带引号);否则输出 "NO"(不带引号)。

输入输出样例

  • 输入#1

    1359257

    输出#1

    YES
  • 输入#2

    17851817

    输出#2

    NO

说明/提示

In the first sample, one of the possible solutions is to buy one house, one car and one computer, spending 1 234 567 + 123 456 + 1234 = 1 359 257 game-coins in total.

在第一个样例中,一种可能的方案是购买一栋房子、一辆汽车和一台电脑,总共花费 1 234 567+123 456+1234=1 359 2571\,234\,567 + 123\,456 + 1234 = 1\,359\,257 枚游戏币。

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

首页