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 ...
随机推荐
- linux之 LVM扩容
1. 查看本机现在磁盘的情况[root@oralce10g ~]# df Filesystem 1K-blocks Used Available Use% Mounted on/dev/mapper/ ...
- CF 914G Sum the Fibonacci——子集卷积
题目:http://codeforces.com/contest/914/problem/G 第一个括号可以子集卷积:第三个括号可以用 FWT 异或卷积:这样算出选两个数组成 x 的方案数:三个部分的 ...
- Phonegap 事件机制
PhoneGap事件包含另个部分,一个是传统网页触发的事件,比如DOM加载,超链接,form表单提交事件等. 另一个是PhoneGap独有的事件.如 deviceready:只在设备在本地环境和页面完 ...
- KMP算法解释
给定两个字符串A,B,判断T是否为S的子串(变式:寻找子串B在串A中的位置). 要求一个O(|A|+|B|)的做法. 通常称A为目标串(或主串),B为模式串. 算法过程: 我们假设串A的长度为n,串B ...
- 给iOS开发新手送点福利,简述UISegment的属性和用法
UISegment属性 1.segmentedControlStyle 设置segment的显示样式. typedef NS_ENUM(NSInteger, UISegmentedControlSty ...
- Backing up the tail
The tail of the transaction log usually refers to the contents of the database's transaction log tha ...
- lnmp架构实现动态php
目录 LNMP动态网站php 1.PHP-FastCGI概述 PHP-FPM安装配置 配置PHP与数据库连接 配置PHP新增扩展模块 配置PHP-FPM主要配置 配置PHP-FPM错误日志 1.编译安 ...
- angularjs中的$http详解
语法: 要将区别先弄清$http服务,它是对原生XMLHttpRequest对象的简单封装,是只能接受一个参数的方法, 这个方法会返回一个promise对象,具有sccess和error两个方法.当然 ...
- Linux 清除N天前的 日期文件夹(yyyy-MM-dd)
本人碰到模糊目录移除,小记一下 1:准确目录情况 2:模糊目录情况 先来介绍准备目录情况 本人在网上找到的demo, 目录结构(在/root/zlogs) 脚本文件b.sh #!/bin/bash ...
- Xcode 中设置部分文件ARC支持
ARC是什么 ARC是iOS 5推出的新功能,全称叫 ARC(Automatic Reference Counting).简单地说,就是代码中自动加入了retain/release,原先需要手动添加的 ...