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 1103 Flo's Restaurant(模拟+优先队列)
Flo's Restaurant Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- KVM中断虚拟化浅析
2017-08-24 今天咱们聊聊KVM中断虚拟化,虚拟机的中断源大致有两种方式,来自于用户空间qemu和来自于KVM内部. 中断虚拟化起始关键在于对中断控制器的虚拟化,中断控制器目前主要有APIC, ...
- [WorldWind学习]23.TerrainAccessor
QuadTile的CreateElevatedMesh()方法中: //获取地形瓦片 TerrainTile tile = QuadTileSet.World.TerrainAccessor.GetE ...
- 10行代码搞定移动web端自定义tap事件
发发牢骚 移动web端里摸爬滚打这么久踩了不少坑,有一定移动web端经验的同学一定被click困扰过.我也不列外.一路走来被虐的不行,fastclick.touchend.iscroll什么的都用过, ...
- django基于cors做跨域处理
背景知识:跨域相关与cors策略 1.安装django-cors-headers pip install django-cors-headers 2.settings.py配置 INSTALLED_A ...
- Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, ...
使用oracle数据库一个多月依赖这问题一直都得不到解决,最近任务不是很忙了,所以决定把这问题解决掉.写一篇文章做记录. 以上错误主要是net程序oracle数据库使用了Microsoft Enter ...
- 004-notepad++安装。
1.下载地址. 官网:https://notepad-plus-plus.org/ 2.安装.
- 在Java中关于二进制、八进制、十六进制的辨析
八进制数中不可能出7以上的阿拉伯数字.但如果这个数是123.是567,或12345670,那么它是八进制数还是10进制数?单从数字的角度来讲都有可能! 八进制 所以在Java中规定,一个数如果要指明它 ...
- uva1391 2-SAT 问题
题意在大白书上. 有3 种工作 abc 大于等于平均年龄的可以去做a c 工作, 小于平均年龄的可以去做 bc , 同样转化为2 -sat 去做, 因为对于每个人也只有2 种情况可以作为选择 #inc ...
- C++之路
我学习C/C++也有两年了.开始是偏爱C语言和C++的语法特性强大,想用来做游戏开发.在深入学习的同时,逐渐了解到C++可以做很多事.大型项目需要用到运行效率高的C++,虽然运行效率越高,开发效率就要 ...