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题,其实也很简单,题目保证了小三角形是正 ...
随机推荐
- curl 模拟GET\POST请求,以及curl post上传文件
https://blog.csdn.net/fungleo/article/details/80703365
- kubernetes实战(八):k8s集群安全机制RBAC
1.基本概念 RBAC(Role-Based Access Control,基于角色的访问控制)在k8s v1.5中引入,在v1.6版本时升级为Beta版本,并成为kubeadm安装方式下的默认选项, ...
- python模块之subprocess模块
简述 subprocess意在替代其他几个老的模块或者函数,比如:os.system os.spawn* os.popen* popen2.* commands.*subprocess最简单的用法就是 ...
- Openstack(九)部署nova服务(控制节点)
9.1nova服务介绍 nova是openstack最早的组件之一,nova分为控制节点和计算节点,计算节点通过nova computer进行虚拟机创建,通过libvirt调用kvm创建虚拟机,nov ...
- Linux(CentOS)系统下搭建svn服务器
由于GitHub的私有项目需要收费,gitlab对服务器的要求必须是4GB内存以上.对于一些个人的小型项目,想要免费的版本控制工具来管理自己的代码,又不想代码公开,无疑SVN是比较好的选择.windo ...
- http-从域名到页面
目录 1. 网络基础 TCP/IP HTTP DNS URI, URL, and URN URI的格式 2. HTTP简单概括 通过实例看HTTP HTTP报文组成 3. 使用Firefox修改请求首 ...
- PAT 1055 The World's Richest[排序][如何不超时]
1055 The World's Richest(25 分) Forbes magazine publishes every year its list of billionaires based o ...
- Java多线程(三)
本文主要接着前面多线程的两篇文章总结Java多线程中的线程安全问题. 一.一个典型的Java线程安全例子 1 public class ThreadTest { 2 3 public static v ...
- Django小项目web聊天
WEBQQ的实现的几种方式 1.HTTP协议特点 首先这里要知道HTTP协议的特点:短链接.无状态! 在不考虑本地缓存的情况举例来说:咱们在连接博客园的时候,当tcp连接后,我会把我自己的http头发 ...
- postgresql主从复制
本文章以rpm包方式安装,版本为9.3.4 一.postgresql安装 postgresql93-9.3.4-1PGDG.rhel6.x86_64.rpm postgresql93-libs-9.3 ...