题目大意:给了三个矩形的长和宽,问第一个能否把其他两个装在内部,要求内部之间不重叠,不出界(可重边)?

题目分析:这道题。。。考虑不够全面导致比赛时没有出来。。。当时,就是觉得自己的代码很完美,不可能不对!当时也是较起真儿来啦,全场就我一个人没A这道题,确实有点脑子热!以后再遇到这种情况一定要冷静!要沉着!越急越没用!!!要重新审视自己的算法和代码!!!!!

代码如下:

# include<iostream>
# include<cstdio>
# include<cmath>
# include<string>
# include<vector>
# include<list>
# include<set>
# include<map>
# include<queue>
# include<cstring>
# include<algorithm>
using namespace std; # define LL long long
# define REP(i,s,n) for(int i=s;i<n;++i)
# define CL(a,b) memset(a,b,sizeof(a))
# define CLL(a,b,n) fill(a,a+n,b) const double inf=1e30;
const int INF=1<<30;
const int N=1000; int a1,b1,a2,b2,a3,b3; bool ok(int a,int b)
{
if(a>=a3&&b>=b3) return true;
if(a>=b3&&b>=a3) return true;
return false;
} bool judge()
{
if(a1*b1<a2*b2+a3*b3) return false;///
if(a1<b1) swap(a1,b1);///
if(a2<b2) swap(a2,b2);///
if(a3<b3) swap(a3,b3);///
if(b2>a1||a2>a1) return false;///
if(b3>a1||a3>a1) return false;///
if(b2+b3>a1) return false;///比赛的时候以上这些都没写,一直过不去
if(ok(b1,a1-a2)) return true;
if(ok(b1,a1-b2)) return true;
if(ok(a1,b1-a2)) return true;
if(ok(a1,b1-b2)) return true;
return false;
} int main()
{
while(~scanf("%d%d%d%d%d%d",&a1,&b1,&a2,&b2,&a3,&b3))
{
if(judge()) printf("YES\n");
else printf("NO\n");
}
return 0;
}

  

Coderforce 560B-Gerald is into Art的更多相关文章

  1. CodeForces 560B Gerald is into Art

     Gerald is into Art time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  2. Gerald is into Art

    Gerald is into Art Gerald bought two very rare paintings at the Sotheby's auction and he now wants t ...

  3. Codeforces Round #313 (Div. 2)B.B. Gerald is into Art

    B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/ ...

  4. Codeforces Round #313 (Div. 2) B. Gerald is into Art 水题

    B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/560 ...

  5. B. Gerald is into Art

    B. Gerald is into Art time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  6. 【打CF,学算法——二星级】Codeforces Round #313 (Div. 2) B. Gerald is into Art(水题)

    [CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/B 题面: B. Gerald is into Art time limit per t ...

  7. Codeforces Round #313 B. Gerald is into Art(简单题)

    B. Gerald is into Art time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  8. 【45.65%】【codeforces 560B】Gerald is into Art

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  9. CodeForces 567A Gerald is into Art

    http://codeforces.com/problemset/problem/567/A A. Lineland Mail time limit per test 3 seconds memory ...

  10. Codeforces Round #313 (Div. 2) A.B,C,D,E Currency System in Geraldion Gerald is into Art Gerald's Hexagon Equivalent Strings

    A题,超级大水题,根据有没有1输出-1和1就行了.我沙茶,把%d写成了%n. B题,也水,两个矩形的长和宽分别加一下,剩下的两个取大的那个,看看是否框得下. C题,其实也很简单,题目保证了小三角形是正 ...

随机推荐

  1. java web 打印(lodop)案例

    应需求接触到lodop 打印. 首先在lodop官网下载相关文件(js.css等):http://www.lodop.net/download.html 在下载好的包里  除了html页面  其他的j ...

  2. 括号匹配问题(区间dp)

    简单的检查括号是否配对正确使用的是栈模拟,这个不必再说,现在将这个问题改变一下:如果给出一个括号序列,问需要把他补全成合法最少需要多少步? 这是一个区间dp问题,我们可以利用区间dp来解决,直接看代码 ...

  3. 程序入口函数和glibc及C++全局构造和析构

    分类: CRT Machnasim 2011-06-15 17:45 144人阅读 评论(0) 收藏 举报 c++汇编linuxlist语言编译器 1,程序入口函数和初始化 操作系统在装载可执行文件后 ...

  4. Can you solve this equation?---hdu2199(二分)

    http://acm.hdu.edu.cn/showproblem.php?pid=2199 给出y的值求x: 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 = Y x是0到100的 ...

  5. 理解本真的REST架构风格(转,解释的最清楚)

    add by zhj start: Fielding在批判性继承前人研究成果的基础上,建立起来一整套研究和评价软件架构的方法论.这套方法论的核心是“架构风格”这个概念.架构风格是一种研究和评价软件架构 ...

  6. Most efficient way to get the last element of a stream

    Do a reduction that simply returns the current value: Stream<T> stream; T last = stream.reduce ...

  7. 商铺项目(Logback配置与使用)

    <?xml version="1.0" encoding="utf-8"?> <configuration debug="false ...

  8. 数据挖掘---支持向量机(SVM)

    •1.SVM 的基本思想: •SVM把分类问题转换成寻求分类平面的问题,并通过最大化分类边界点到分类平面的距离来实现分类.通俗的讲支持向量机的解决的问题是找到最好的分类超平面.支持向量机(Suppor ...

  9. 妙用Excel数据透视表和透视图向导,将二维数据转换为一维数据

    项目中,每年都会有各种经销商的各种产品目标数据导入,经销商和产品过多,手工操作过于单调和复杂.那有没有一种方式可以将复杂的二维数据转换为一维数据呢? 有,强大的Excel就支持此功能. 常用Excel ...

  10. Bootstrap fileinput v1.0(ssm版)

    前言bootstrap fileinput是一个很好的文件上传插件.但是官方不出api,这就尴尬了.百度一下,每个人写法都不相同,好多代码本身都是错的.我修改后才能跑起来.综上所述:所以今天我摸索了一 ...