CodeForces 681B Economy Game
来源:互联网 发布:包公权知开封府 编辑:程序博客网 时间:2024/05/18 21:10
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).
Example
Input
1359257OutputYESInput17851817OutputNO
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.
/*枚举 */ #include <stdio.h>#define num1 1234567#define num2 123456#define num3 1234int main(){ int a=1; long long int n; scanf("%lld",&n); for (int i=0;i<=811;i++)//811*1234567=1001233837 for (int j=0;j<=8011;j++)//8011*123456=989006016 { int m=n-(i*num1+j*num2); if(m<0)//当mx小于0的情况不用考虑 break; if(m%num3==0) { a=0; break; } } if(a==0) printf("YES"); else printf("NO"); return 0;}
0 0
- CodeForces 681B Economy Game
- CodeForces - 681B Economy Game
- CodeForces-681B.Economy Game
- CodeForces 681B Economy Game
- CodeForces 681B Economy Game (暴力)
- 【codeforces 681B】【优化循环】Economy Game
- CodeForces 681B Economy Game(百钱买白鸡类问题)
- 【cf 681B】 Economy Game
- B. Economy Game
- Codeforces Round #357 (Div. 2) B. Economy Game
- Codeforces Round #357 (Div. 2)-B. Economy Game
- Codeforces Round #357 (Div. 2) B. Economy Game
- Codeforces Round #357 (Div. 2) B. Economy Game
- Codeforces Round #357 (Div. 2) B. Economy Game (暴力)
- Codeforces Round #357 (Div. 2) B Economy Game(水题)
- Codeforces-Round-#357-(Div.-2)-Economy-Game
- CF #357 div2 B Economy Game
- Economy Game
- PAT_1026. Table Tennis (2个case没过)
- git
- VMware虚拟机centOS7和主机win10的ping问题
- H5调用本地app
- 如何开好迭代回顾会议(3)教练、不同的口味
- CodeForces 681B Economy Game
- Rxjava初理解
- Android6.0和7.0新特性
- npm 安装vue时报错
- 大数据分页方案---數據庫的使用
- 六、IBM Minus One
- java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com
- foxmail自动接收邮件的时间设置
- Qt——正则表达式