B. Economy Game
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Input

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

Output

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

Examples
Input
1359257
Output
YES
Input
17851817
Output
NO
Note

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.

题意:是否存在a*1234567+b*123456+c*1234=n 存在则输出YES 否则输出NO

题解:暴力处理

 #include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define ll __int64
ll n;
int main()
{
scanf("%I64d",&n);
int flag=;
for(int i=;i<=n/;i++)
for(int j=;j<=n/;j++)
{
if((i*+j*<=n)&&(n-i*-j*)%==)
{
flag=;
break;
}
}
if(flag)
printf("YES\n");
else
printf("NO\n"); return ;
}

Codeforces Round #357 (Div. 2) B的更多相关文章

  1. Codeforces Round #357 (Div. 2) E. Runaway to a Shadow 计算几何

    E. Runaway to a Shadow 题目连接: http://www.codeforces.com/contest/681/problem/E Description Dima is liv ...

  2. Codeforces Round #357 (Div. 2) D. Gifts by the List 水题

    D. Gifts by the List 题目连接: http://www.codeforces.com/contest/681/problem/D Description Sasha lives i ...

  3. Codeforces Round #357 (Div. 2) C. Heap Operations 模拟

    C. Heap Operations 题目连接: http://www.codeforces.com/contest/681/problem/C Description Petya has recen ...

  4. Codeforces Round #357 (Div. 2) B. Economy Game 水题

    B. Economy Game 题目连接: http://www.codeforces.com/contest/681/problem/B Description Kolya is developin ...

  5. Codeforces Round #357 (Div. 2) A. A Good Contest 水题

    A. A Good Contest 题目连接: http://www.codeforces.com/contest/681/problem/A Description Codeforces user' ...

  6. Codeforces Round #357 (Div. 2) A

    A. A Good Contest time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  7. Codeforces Round #357 (Div. 2) E 计算几何

    传说中做cf不补题等于没做 于是第一次补...这次的cf没有做出来DE D题的描述神奇 到现在也没有看懂 于是只补了E 每次div2都是hack前2~3题 终于打出一次hack后的三题了...希望以后 ...

  8. Codeforces Round #357 (Div. 2) 优先队列+模拟

    C. Heap Operations time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  9. Codeforces Round #357 (Div. 2) C

    C. Heap Operations time limit per test 1 second memory limit per test 256 megabytes input standard i ...

随机推荐

  1. js获取url参数方法

    function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&] ...

  2. 深入理解yii2之RBAC(模块化系统)

    一.前言 上一篇文章我们已经大致谈过RBAC到底是什么和yii2底层RBAC接口的分析. 下面我深入理解一下RBAC权限分配,深入理解下yii2底层RBAC扩展,以及它是如何针对模块化系统的开发的? ...

  3. Apache安装之后,在浏览器输入ip无法访问

    博主本来在linux下面配置安装了apache,然后用浏览器输入ip却无法访问 就一直在想是不是dns无法解析的问题,最后才发现原来是防火墙的原因, 在linux下面 service iptables ...

  4. [C#]常用开源项目

    [转][C#]常用开源项目 本文来自:http://www.cnblogs.com/sunxuchu/p/6047589.html Json.NET http://www.newtonsoft.com ...

  5. POJ:3258-River Hopscotch

    River Hopscotch Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17740 Accepted: 7414 Desc ...

  6. ABAP News for Release 7.51 – ABAP CDS Client Handling

    Open SQLは自動的クライアント処理をサポートしています. Open SQLでクライアント依存のデータソースにアクセスする時.デフォルトでは現在のクライアントのデータだけが考慮されます. クライア ...

  7. 动态调试smali代码

    Android Killer对应用进行反编译为smali代码,看看Manifest文件中application标签里面是否有android:debuggable="true",没有 ...

  8. linux c 调用子文件函数

    今天在学习初级linux c的时候遇到了如下问题:通过主函数调用同路径下的子文件函数调用失败.博主是这样一一解决的: 首先:hello.c: hello.c: #include<bool.c&g ...

  9. hive-pom.xml

    4.0.0 <groupId>com.cenzhongman</groupId> <artifactId>hive</artifactId> <v ...

  10. No module named appium

    在脚本中会有:from appium import webdriver 第一次运行时可能会遇到这样的error:No module named appium 之所以会报这样的error是因为没有装cl ...