题意:给定一个数,问能不能 找到非负 a, b, c,使得 a × 1 234 567 + b × 123 456 + c × 1 234 = n

析:二重循环,去确定c。

代码如下:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector> using namespace std;
const int aa = 1234567;
const int bb = 123456;
const int cc = 1234; int main(){
int n; scanf("%d", &n);
bool ok = false;
for(int i = 0; i * aa <= n; ++i)
for(int j = 0; i*aa + j*bb <= n; ++j)
if((n-i*aa-j*bb)%cc == 0) { puts("YES"); return 0; } puts("NO");
return 0;
}

CodeForces 681B Economy Game (暴力)的更多相关文章

  1. codeforces 724B Batch Sort(暴力-列交换一次每行交换一次)

    题目链接:http://codeforces.com/problemset/problem/724/B 题目大意: 给出N*M矩阵,对于该矩阵有两种操作: (保证,每行输入的数是 1-m 之间的数且不 ...

  2. codeforces 897A Scarborough Fair 暴力签到

    codeforces 897A Scarborough Fair 题目链接: http://codeforces.com/problemset/problem/897/A 思路: 暴力大法好 代码: ...

  3. Codeforces A. Playlist(暴力剪枝)

    题目描述: Playlist time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...

  4. [codeforces 200 A Cinema]暴力,优化

    题意大致是这样的:有一个有n行.每行m个格子的矩形,每次往指定格子里填石子,如果指定格子里已经填过了,则找到与其曼哈顿距离最小的格子,然后填进去,有多个的时候依次按x.y从小到大排序然后取最小的.输出 ...

  5. Codeforces Gym 100531D Digits 暴力

    Problem D. Digits 题目连接: http://codeforces.com/gym/100531/attachments Description Little Petya likes ...

  6. CodeForces 589B Layer Cake (暴力)

    题意:给定 n 个矩形是a*b的,问你把每一块都分成一样的,然后全放一块,高度都是1,体积最大是多少. 析:这个题,当时并没有完全读懂题意,而且也不怎么会做,没想到就是一个暴力,先排序,先从大的开始选 ...

  7. Codeforces Gym 100418K Cards 暴力打表

    CardsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action? ...

  8. Codeforces Round #434 (Div. 2, based on Technocup 2018 Elimination Round 1)&&Codeforces 861A k-rounding【暴力】

    A. k-rounding time limit per test:1 second memory limit per test:256 megabytes input:standard input ...

  9. Educational Codeforces Round 21(A.暴力,B.前缀和,C.贪心)

    A. Lucky Year time limit per test:1 second memory limit per test:256 megabytes input:standard input ...

随机推荐

  1. python学习(一)—简明python教程

    2016-04-12 15:59:47 1. 介绍2. 安装Python3. 最初的步骤4. 基本概念5. 运算符与表达式6. 控制流7. 函数8. 模块9. 数据结构10. 解决问题——编写一个Py ...

  2. FastAdmin 升级后出现 is already in use

    FastAdmin 升级后出现 is already in use 升级 FastAdmin 改进很多,但全新安装出现以下错误 Cannot use app\common\library\Menu a ...

  3. FastAdmin 学习线路 (2018-06-09 更新)

    FastAdmin 学习线路 以下为常规线路,非常规可跳过. FastAdmin 学习线路 基础 HTML CSS DIV Javascript 基础 jQuery php 基础 对象 命名空间 进阶 ...

  4. Oracle VM VirtualBox安裝Windows 2000失败

    问题: VirtualBox下安装Windows2000,设置网络后进入最后一步,复制组件……然后就是重启:再试还是重启!   解决: 在Oracle网站上查了一下资料:http://www.virt ...

  5. java中如何制定自定义异常

    package gys; public class ExpetionTest { public static void main(String[] args) { NumberCheck n=new ...

  6. 基于git的管理应用程序基线包和版本

    由于工作的需要,身为git的小白的我开始研究git相关的命令和操作.结合网上收集和廖雪峰的git教程,记录所学知识点. 相关的效果就不再这里显示了. 首先我们看一下git的常用命令: 常用命令 git ...

  7. vim删除行首数字

  8. 4 ways to pass parameter from JSF page to backing bean

    As i know,there are 4 ways to pass a parameter value from JSF page to backing bean : Method expressi ...

  9. my sql存储过程 基本使用

    --------------创建不带参数的存储过程----------------- DELIMITER;; drop PROCEDURE if EXISTS selectStudent; creat ...

  10. MVC-READ1

    将具有不同稳定性的元素融为一体,具有最差稳定性的元素决定了整体的稳定性,这是“短板理论”在软件设计中的体现. MVC的创建者是Trygve M. H. Reenskau,他是挪威的计算机专家,同时也是 ...