Codeforces Round #357 (Div. 2) B
1 second
256 megabytes
standard input
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.
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, 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的更多相关文章
- 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 ...
- 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 ...
- Codeforces Round #357 (Div. 2) C. Heap Operations 模拟
C. Heap Operations 题目连接: http://www.codeforces.com/contest/681/problem/C Description Petya has recen ...
- Codeforces Round #357 (Div. 2) B. Economy Game 水题
B. Economy Game 题目连接: http://www.codeforces.com/contest/681/problem/B Description Kolya is developin ...
- Codeforces Round #357 (Div. 2) A. A Good Contest 水题
A. A Good Contest 题目连接: http://www.codeforces.com/contest/681/problem/A Description Codeforces user' ...
- 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 ...
- Codeforces Round #357 (Div. 2) E 计算几何
传说中做cf不补题等于没做 于是第一次补...这次的cf没有做出来DE D题的描述神奇 到现在也没有看懂 于是只补了E 每次div2都是hack前2~3题 终于打出一次hack后的三题了...希望以后 ...
- Codeforces Round #357 (Div. 2) 优先队列+模拟
C. Heap Operations time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces Round #357 (Div. 2) C
C. Heap Operations time limit per test 1 second memory limit per test 256 megabytes input standard i ...
随机推荐
- exa命令详解
exa 是 ls 文件列表命令现代化替代品. 官网:https://the.exa.website/ GitHub:https://github.com/ogham/exa 后续整理中……
- linux命令讲解
1.vi命令 1.光标移动到文件的最后一行 G :$ ]] 2.光标移动到文件的第一行 :0 gg [[ 3.从光标所在位置将光标移动到当前行的开头 0 ^ ...
- js三目运算符执行多个条件
三元运算符的结果语句可以执行多个操作,每个操作用逗号分隔就可以,例子如下: var a=1: a>5?(alert(1),alert(2)):(alert(3),alert(4))
- JavaSE 第二次学习随笔(String的坑 + ==)
String 类是一个final类, 其内部是使用的 private final char value[]; 来存储内容, 其既可以当作一个基本类型来使用也可以当作一个类来使用;final 类(Str ...
- 学习Pytbon第十七篇,面向对象编程
面向对象技术简介 类(Class): 用来描述具有相同的属性和方法的对象的集合.它定义了该集合中每个对象所共有的属性和方法.对象是类的实例. 类变量:类变量在整个实例化的对象中是公用的.类变量定义在类 ...
- 基于appium的app自动化测试框架
基于appium框架的app自动化测试 App自动化测试主要难点在于环境的搭建,appium完全是基于selenium进行的扩展,所以app测试框架也是基于web测试框架开发的 一.设备连接 (即构建 ...
- WPF仿酷狗页面
原文:WPF仿酷狗页面 版权声明:本文为博主原创文章,如需转载请标明转载地址 http://blog.csdn.net/u013981858 https://blog.csdn.net/u013981 ...
- app图标
1.http://www.iconfont.cn/ 在里面可以搜索你想要的图标: 比如关闭. 2.选择一个好看的下载png 3.打开ps,ctrl n新建一个图层. 把你下载的png弄到上面,然后关闭 ...
- ajax跨域请求_url:http://XXX
利用别的项目提供的一个接口,传入用户名和密码,根据返回的结果判断登陆成功与否. 不经过后台,在js中用ajax实现.对ajax而言,发送跨域请求,与一般写法不同. 如果支持jsonp,则将dataTy ...
- VSX-5 VSXMusic 编码听音乐
给VS写个扩展来听音乐的说法,缘来已久,这两天做了个初版,使用豆瓣FM,先发出来. 插件现在只做了VS2013的,别的版本有待下一步支持. 现在暂时只有一个Adornment(就是那个有封面的),一个 ...