Codeforces Round #357 (Div. 2) B

时间:2022-10-03 17:20:08
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 &num;357 &lpar;Div&period; 2&rpar; E&period; Runaway to a Shadow 计算几何

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

  2. Codeforces Round &num;357 &lpar;Div&period; 2&rpar; D&period; Gifts by the List 水题

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

  3. Codeforces Round &num;357 &lpar;Div&period; 2&rpar; C&period; Heap Operations 模拟

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

  4. Codeforces Round &num;357 &lpar;Div&period; 2&rpar; B&period; Economy Game 水题

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

  5. Codeforces Round &num;357 &lpar;Div&period; 2&rpar; A&period; A Good Contest 水题

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

  6. Codeforces Round &num;357 &lpar;Div&period; 2&rpar; A

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

  7. Codeforces Round &num;357 &lpar;Div&period; 2&rpar; E 计算几何

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

  8. Codeforces Round &num;357 &lpar;Div&period; 2&rpar; 优先队列&plus;模拟

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

  9. Codeforces Round &num;357 &lpar;Div&period; 2&rpar; C

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

随机推荐

  1. imx6 关闭调试串口

    需要关闭imx6调试串口,用作普通的串口使用. 参考链接 http://blog.csdn.net/neiloid/article/details/7585876 http://www.cnblogs ...

  2. 移动h5开发资源整理

    这2年来,移动h5开发逐渐成为一种主流,也不断趋向于成熟.硬件和浏览器的不断更新,曾经的浏览器兼容也不再是开发者的噩梦. 接触h5开发一年多,从最初的新手到现在,陆陆续续遇到过很多坑.这里把想到的一些 ...

  3. sql 中实现打乱数据的排序

    sql 中实现打乱数据的排序    order by NEWID()就实现了数据的打乱 

  4. Bootstrap Alert Auto Close

    http://*.com/questions/23101966/bootstrap-alert-auto-close http://jsfiddle.net/mfX57/ $( ...

  5. Relevance Between Variable Declaration and Definition in C&plus;&plus;

    A declaration makes a name known to a programm. A definition creates the assocatied entity. A variab ...

  6. Ollivanders&colon; Makers of Fine Wands since 382 BC&period;

    Ollivanders: Makers of Fine Wands since 382 BC.                                               Time L ...

  7. mapreduce &lpar;七&rpar; 几个实例

    http://hi.baidu.com/hzd2712/item/d2465ae65270ab3e4cdcaf55 MapReduce几个典型的例子 在Google的<MapReduce: Si ...

  8. iOS 快速集成启动页广告

    前言 由于项目中要用到启动页广告,所以做了简单的研究,同时借鉴网易新闻和蘑菇街的交互写了一个简单的demo,现在写出来供大家参考,可能由于个人局限会有一些bug和不完善的地方,也希望大家能够友善提醒和 ...

  9. 通过python的hashlib模块计算一个文件的MD5值

    Python的hashlib提供了很多摘要算法,如MD5,SHA1等常用算法. 什么是摘要算法呢?摘要算法又称哈希算法.散列算法.它通过一个函数,把任意长度的数据转换为一个长度固定的数据串(如MD5值 ...

  10. spring框架学习笔记3:使用注解代替配置文件

    1.导入context约束:spring-context-4.2.xsd 2.design模式打开xml配置文件,右键edit namespaces,点击add添加 完成后应该是这样: 配置文件中这样 ...