CodeForces 681B Economy Game (暴力)
题意:给定一个数,问能不能 找到非负 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 (暴力)的更多相关文章
- codeforces 724B Batch Sort(暴力-列交换一次每行交换一次)
题目链接:http://codeforces.com/problemset/problem/724/B 题目大意: 给出N*M矩阵,对于该矩阵有两种操作: (保证,每行输入的数是 1-m 之间的数且不 ...
- codeforces 897A Scarborough Fair 暴力签到
codeforces 897A Scarborough Fair 题目链接: http://codeforces.com/problemset/problem/897/A 思路: 暴力大法好 代码: ...
- Codeforces A. Playlist(暴力剪枝)
题目描述: Playlist time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...
- [codeforces 200 A Cinema]暴力,优化
题意大致是这样的:有一个有n行.每行m个格子的矩形,每次往指定格子里填石子,如果指定格子里已经填过了,则找到与其曼哈顿距离最小的格子,然后填进去,有多个的时候依次按x.y从小到大排序然后取最小的.输出 ...
- Codeforces Gym 100531D Digits 暴力
Problem D. Digits 题目连接: http://codeforces.com/gym/100531/attachments Description Little Petya likes ...
- CodeForces 589B Layer Cake (暴力)
题意:给定 n 个矩形是a*b的,问你把每一块都分成一样的,然后全放一块,高度都是1,体积最大是多少. 析:这个题,当时并没有完全读懂题意,而且也不怎么会做,没想到就是一个暴力,先排序,先从大的开始选 ...
- Codeforces Gym 100418K Cards 暴力打表
CardsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action? ...
- 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 ...
- 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 ...
随机推荐
- Programming Languages: Application and Interpretation
http://cs.brown.edu/courses/cs173/2012/book/ 1 Introduction 1.1 Our Philosophy 1.2 The Structure of ...
- bzoj3191卡牌游戏
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3191 原本想模拟过程,从t个人推到1个人: 但是怎么转移呢?想状压,可是50位压不到角标里. ...
- FreeFileSync 4.2 发布,文件夹比较和同步工具
FreeFileSync 是一款开源的文件夹比较和同步工具,可用于 Win 和 Lin 平台,最近发布了 4.2 版本. FreeFileSync 采用双面板设计,使用方法很简单: 在左面版和右面版上 ...
- Nginx+tomcat+redis 集群session共享
插件资源下载地址:https://github.com/ran-jit/tomcat-cluster-redis-session-manager/releases/tag/2.0.2 一.前置条件 J ...
- JWPlayer快速入门指南(中文)
将JW Player嵌入到网页中非常的简单,只需要进行如下3个步骤: 1.解压mediaplayer-viral.zip文件,将jwplayer.js和player.swf文件拷贝到工程中: 2.在页 ...
- Mongodb 集群加keyFile认证
介绍 自从远古计绳结开始,数据库的存储就注定了今天的地位和多样性,Nosql的出现更是解决了现有的关系型数据库无法解决的一些难题,对高性能,灵活度,扩展性,海量数据的问题.随之而出现的高速内存索引数据 ...
- UCI一位搞theory的教授列的一些数学方面的比较趣味性的网页
http://www.ics.uci.edu/~eppstein/recmath.html 据说是recreational的,没具体看,先收藏下来.
- HTTP 协议基础
HTTP 协议的主要特点可概括如下: 1.支持客户/服务器模式. 2.简单快速:客户向服务器请求服务时,只需传送请求方法和路径.请求方法常用的有GET.HEAD.POST.每种方法规定了客户与服务器联 ...
- JAVA 非对称加密工具
import java.io.File; import java.io.FileInputStream; import java.math.BigInteger; import java.securi ...
- SpringMVC @RequestBody请求参数在postman中的请求
使用SpringMVC框架,controller使用参数 @RequestBody LoginReq req 注解方式模拟http请求 需要请求header添加一个参数 设置 Header参 ...