Description

standard input/output
Statements

Alex is repairing his country house. He has a rectangular metal sheet of size a × b. He has to cut two rectangular sheets of sizes a1 × b1and a2 × b2 from it. All cuts must be parallel to the sides of the initial sheet. Determine if he can do it.

Input

The first line contains two space-separated integers a and b (1 ≤ a, b ≤ 109) — the sizes of the initial sheet.

The second line contains two space-separated integers a1 and b1 (1 ≤ a1, b1 ≤ 109) — the sizes of the first sheet to cut out.

The third line contains two space-separated integers a2 and b2 (1 ≤ a2, b2 ≤ 109) — the sizes of the second sheet to cut out.

Output

Output «YES» (without quotes), if it's possible to cut two described sheets from the initial sheet, or «NO» (without quotes), if it's not possible.

Sample Input

Input
12 20
14 7
5 6
Output
YES
Input
12 20
11 9
20 7
Output
NO

枚举那两个小长方形的形状,要么躺着,要么倒着,
然后位置关系也有2中,上下或者左右。一共8种情况
枚举有技巧,不用全部写if。考怒写循环。
固定1,枚举2的两种形状,枚举2的位置关系。
固定2,枚举1的两种形状,枚举1的位置关系。
这样做的话,没法做到同时转换1和转换2.
那么考虑转换大长方形再来一次,就能考怒完全部。
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL; #include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
struct data {
int row, col;
} a[];
bool check(int torow, int tocol) {
if (torow <= a[].row && tocol <= a[].col) return true;
else return false;
}
void work() {
for (int i = ; i <= ; ++i) {
cin >> a[i].row >> a[i].col;
}
bool flag = false;
for (int i = ; i <= && !flag; ++i) {
if (check(max(a[].row, a[].row), a[].col + a[].col)) {
flag = true;
}
if (check(a[].row + a[].row, max(a[].col, a[].col))) {
flag = true;
}
swap(a[].row, a[].col);
}
// cout << a[3].row << " " << a[3].col << endl;
for (int i = ; i <= && !flag; ++i) {
if (check(max(a[].row, a[].row), a[].col + a[].col)) {
flag = true;
}
if (check(a[].row + a[].row, max(a[].col, a[].col))) {
flag = true;
}
swap(a[].row, a[].col);
}
swap(a[].row, a[].col);
for (int i = ; i <= && !flag; ++i) {
if (check(max(a[].row, a[].row), a[].col + a[].col)) {
flag = true;
}
if (check(a[].row + a[].row, max(a[].col, a[].col))) {
flag = true;
}
swap(a[].row, a[].col);
}
// cout << a[3].row << " " << a[3].col << endl;
for (int i = ; i <= && !flag; ++i) {
if (check(max(a[].row, a[].row), a[].col + a[].col)) {
flag = true;
}
if (check(a[].row + a[].row, max(a[].col, a[].col))) {
flag = true;
}
swap(a[].row, a[].col);
} if (flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
} int main() {
#ifdef local
freopen("data.txt","r",stdin);
#endif
work();
return ;
}
 

Repair 暴力的更多相关文章

  1. CodeForces 730G Car Repair Shop (暴力)

    题意:给定 n 个工作的最好开始时间,和持续时间,现在有两种方法,第一种,如果当前的工作能够恰好在最好时间开始,那么就开始,第二种,如果不能,那么就从前找最小的时间点,来完成. 析:直接暴力,每次都先 ...

  2. 通用高效的数据修复方法:Row level repair

    导读:随着大数据的进一步发展,NoSQL 数据库系统迅速发展并得到了广泛的应用.其中,Apache Cassandra 是最广泛使用的数据库之一.对于 Cassandra 的优化是大家研究的热点,而 ...

  3. zone.js - 暴力之美

    在ng2的开发过程中,Angular团队为我们带来了一个新的库 – zone.js.zone.js的设计灵感来源于Dart语言,它描述JavaScript执行过程的上下文,可以在异步任务之间进行持久性 ...

  4. [bzoj3123][sdoi2013森林] (树上主席树+lca+并查集启发式合并+暴力重构森林)

    Description Input 第一行包含一个正整数testcase,表示当前测试数据的测试点编号.保证1≤testcase≤20. 第二行包含三个整数N,M,T,分别表示节点数.初始边数.操作数 ...

  5. HDU 5944 Fxx and string(暴力/枚举)

    传送门 Fxx and string Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Othe ...

  6. 1250 Super Fast Fourier Transform(湘潭邀请赛 暴力 思维)

    湘潭邀请赛的一题,名字叫"超级FFT"最终暴力就行,还是思维不够灵活,要吸取教训. 由于每组数据总量只有1e5这个级别,和不超过1e6,故先预处理再暴力即可. #include&l ...

  7. fragment+viepager 的简单暴力的切换方式

    这里是自定义了一个方法来获取viewpager private static ViewPager viewPager; public static ViewPager getMyViewPager() ...

  8. ACM: Gym 101047M Removing coins in Kem Kadrãn - 暴力

     Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Fo ...

  9. uoj98未来程序改 纯暴力不要想了

    暴力模拟A了,数据还是良(shui)心(shui)的 90分的地方卡了半天最后发现一个局部变量被我手抖写到全局去了,,, 心碎*∞ 没什么好解释的,其实只要写完表达式求值(带函数和变量的),然后处理一 ...

随机推荐

  1. Python 写文件时的Unicode设置

    今天在把Evenote的笔记内容写为文件时出错:     f.write(content) UnicodeEncodeError: &apos;gbk&apos; codec can& ...

  2. smbpasswd和pdbedit

    samba用户管理: smbpasswd :smbpasswd命令属于samba套件,能够实现添加或删除samba用户和为用户修改密码. smbpasswd [options] USERNAME -a ...

  3. ORM查询相关

    一.多对多的正反向查询 class Class(models.Model): name = models.CharField(max_length=32,verbose_name="班级名& ...

  4. linux日常管理-netstat查看端口

    查看网络链接状况 查看监听端口 查看服务端 客户端链接状况 并发 ////////////////////////////////////////////////////////////////// ...

  5. 15 Practical Grep Command Examples In Linux / UNIX

    You should get a grip on the Linux grep command. This is part of the on-going 15 Examples series, wh ...

  6. 线程中t.setdaemon(), t.jion(), t.start的使用

    import threading import time def f0(): pass def f1(a1,a2): time.sleep(10) f0() ") t1 = threadin ...

  7. Linux中发布项目的一些命令笔记

    记一下,Linux中发布项目的一些难记的命令: .安装jdk a.检测是否安装了jdk 运行java -version b.若有需要将其卸载 c.查看安装那些jdk rpm -qa | grep ja ...

  8. boost编译BUG

    linux GCC环境,boost在编译时未加-fPIC参数,导致如果有共享库使用boost静态库,会报如下错误:relocation R_X86_64_32 against `a local sym ...

  9. git branch简单使用

    1,branch的建立及使用git clone user@192.168.0.136:/media/projiect/omap4/nexttab/kernel kernel/android3.0/  ...

  10. ASP.NET MVC 小牛之旅2:体验第一个MVC程序

    了解了什么是MVC之后,接下来用一个非常简单的留言板程序概要的了解MVC网站开发的过程,对MVC开发有个大致的轮廓.第一个项目将不会提到过多与数据库相关的技术,因此将以Framework Code F ...