Coderforce 560B-Gerald is into Art
题目大意:给了三个矩形的长和宽,问第一个能否把其他两个装在内部,要求内部之间不重叠,不出界(可重边)?
题目分析:这道题。。。考虑不够全面导致比赛时没有出来。。。当时,就是觉得自己的代码很完美,不可能不对!当时也是较起真儿来啦,全场就我一个人没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的更多相关文章
- CodeForces 560B Gerald is into Art
Gerald is into Art time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Gerald is into Art
Gerald is into Art Gerald bought two very rare paintings at the Sotheby's auction and he now wants t ...
- 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/ ...
- 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 ...
- B. Gerald is into Art
B. Gerald is into Art time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- 【打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 ...
- 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 ...
- 【45.65%】【codeforces 560B】Gerald is into Art
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- CodeForces 567A Gerald is into Art
http://codeforces.com/problemset/problem/567/A A. Lineland Mail time limit per test 3 seconds memory ...
- 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题,其实也很简单,题目保证了小三角形是正 ...
随机推荐
- HDU_3183_A Magic Lamp
A Magic Lamp Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tota ...
- OSX: 下载Flash Player的脚本
http://blog.csdn.net/cneducation/article/details/54742983
- scrapy爬虫系列之七--scrapy_redis的使用
功能点:如何发送携带cookie访问登录后的页面,如何发送post请求登录 简单介绍: 安装:pip3 install scrapy_redis 在scrapy的基础上实现了更多的功能:如reques ...
- 点击劫持漏洞解决( Clickjacking: X-Frame-Options header missing)
点击劫持漏洞 X-Frame-Options HTTP 响应头, 可以指示浏览器是否应该加载一个 iframe 中的页面. 网站可以通过设置 X-Frame-Options 阻止站点内的页面被其他页面 ...
- 持续交付的Mesos与Docker导入篇
变革这个词在当今的数字化时代司空见惯,IT技术每过一段时间就会有一起革新,从WEB2.0.虚拟化.云计算.大数据.微架构.DevOps再到今天的容器Docker与Mesos. Docker的出现方便了 ...
- 【接口测试】接口概念及Json相关
一.接口相关概念 1.什么是接口? 接口:接口就是系统A程序中留的其他系统B访问系统A的接口(实际上是系统某个代码文件下某一个可访问的方法.).其他系统B可以调用这个方法a对系统A中的方法a进行访问从 ...
- google浏览器插件安装
1:安装本地插件,直接将下载好的crx插件拖入到 chrome://extensions/ 的空白处 http://www.cnplugins.com/tool/outline-instal ...
- js动态移动滚动条至底部示例
使用js动态移动滚动条至底部. var currentPosition,timer; function GoBottom(){ timer=setInterval("runToBotto ...
- 单台DNS服务器搭建(BIND)
一.理论层面 1. DNS的出现及演化 网络出现的早期是使用IP地址通讯的,那是就几台主机通讯.但是随着接入网络主机的增多,这种数字标识的地址非常不便于记忆,UNIX上就出现了建立一个叫做hosts的 ...
- mongodb安装及副本集搭建
mongodb下载地址:https://www.mongodb.com/dr/fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.2.7.tg ...