Codeforces Round #357 (Div. 2) B Economy Game(水题)
来源:互联网 发布:axentwear淘宝 编辑:程序博客网 时间:2024/06/06 19:42
思路:水题,注意c为0这种情况即可
#include<bits/stdc++.h>using namespace std;int main(){int n;int flag = 0;scanf("%d",&n);for(int i = 0;i<100;i++){for(int j = 0;j<1000;j++){if(n-1234567*i-j*123456==0)flag=1;if(n-1234567*i-j*123456>=1234){int res = n-1234567*i-j*123456;if(res%1234==0)flag=1;}}}if(flag)printf("YES\n");elseprintf("NO\n");}
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 (for1 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 thata × 1 234 567 + b × 123 456 + c × 1 234 = n?
Please help Kolya answer this question.
The first line of the input contains a single integer n (1 ≤ n ≤ 109) — Kolya's initial game-coin score.
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).
1359257
YES
17851817
NO
In the first sample, one of the possible solutions is to buy one house, one car and one computer, spending1 234 567 + 123 456 + 1234 = 1 359 257 game-coins in total.
- 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
- CodeForces 681B Economy Game
- CodeForces - 681B Economy Game
- CodeForces-681B.Economy Game
- CodeForces 681B Economy Game
- Codeforces Round #316 (Div. 2) -B-Simple Game-水题
- Codeforces Round #316 (Div. 2) B. Simple Game (模拟)
- B. Simple Game-----(Codeforces Round #316 (Div. 2))
- CodeForces 681B Economy Game(百钱买白鸡类问题)
- CodeForces 681B Economy Game (暴力)
- 【codeforces 681B】【优化循环】Economy Game
- Codeforces Round #128 (Div. 2) B. Game on Paper
- ffmpeg实现音频resample(重采样)
- Github 配置SSH KEY
- 1199.GCD
- poj 1742 coins
- 关闭 C4996 警告(_CRT_SECURE_NO_DEPRECATE)方法
- Codeforces Round #357 (Div. 2) B Economy Game(水题)
- asp.net页面 <Triggers>用法
- Lnmp 支持thinkphp
- tf.app.run()
- 对AS3.0的一些总结
- Codeforces Round #357 (Div. 2) C Heap Operations(模拟)
- android listView 相关
- ssi整合开发层次总结
- JAVA多线程实现的三种方式