您的位置:首页 > 编程语言 > Go语言

Codeforces 560B Gerald is into Art

2015-07-24 15:42 597 查看
题目链接:http://codeforces.com/problemset/problem/560/B

题       意:给你三个矩形的长和宽,问后两个能否放在第一个中(且不重叠)

思       路:将八种情况列出。

#include <iostream>
using namespace std;
#include <string.h>
#include <stdio.h>
#include <queue>
#include <algorithm>
int main()
{
int n,m;
while(scanf ( "%d %d", &n, &m ) != EOF )
{
int x,y,a,b;
int f=0;
scanf ( "%d%d%d%d",&x,&y,&a,&b);
if(y+b<=m)
{
if(max(x,a)<=n) f=1;//注意不能改x,y,a,b,n,m的值
}
if(y+b<=n)
{
if(max(x,a)<=m) f=1;
}
if(x+a<=n)
{
if(max(y,b)<=m) f=1;
}
if(x+a<=m)
{
if(max(y,b)<=n) f=1;
}
if(y+a<=m)
{
if(max(x,b)<=n) f=1;
}
if(y+a<=n)
{
if(max(x,b)<=m) f=1;
}
if(x+b<=n)
{
if(max(y,a)<=m) f=1;
}
if(x+b<=m)
{
if(max(y,a)<=n) f=1;
}
if(f) printf("YES\n");
else printf("NO\n");
}
return 0;
}


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  codeforces algorithm