hiho1255 Mysterious Antiques in Sackler Museum
题目链接:http://media.hihocoder.com/contests/icpcbeijing2015/problems.pdf
题目大意:给你四个矩形,判断是否能取其中任意三个组成一个大矩形
思路:模拟暴力
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
struct bones{
int width;
int height;
bones(int width0=,int height0=){
width=width0;
height=height0;
}
};
int maxx;
int area;
bones a[];
bones tmp[];
bones Add(bones a1,bones a2){
if(a1.width==a2.height) return bones(a1.width,a1.height+a2.width);
if(a1.width==a2.width) return bones(a1.width,a1.height+a2.height);
if(a2.width==a1.height) return bones(a2.width,a2.height+a1.width);
if(a2.height==a1.height) return bones(a1.height,a1.width+a2.width);
return bones(,); }
bool solve(bones a1,bones a2,bones a3){
bones tmp;
tmp=Add(a1,a2);
tmp=Add(tmp,a3);
if(tmp.width>) {
return true;}
tmp=Add(a1,a3);
tmp=Add(tmp,a2);
if(tmp.width>) {
return true;}
tmp=Add(a2,a3);
tmp=Add(tmp,a1);
if(tmp.width>) {return true;}
return false;
}
void print(){
if(solve(a[],a[],a[])||solve(a[],a[],a[])||solve(a[],a[],a[])||solve(a[],a[],a[])){
printf("Yes\n");
return ;
}
printf("No\n");
return ;
}
int main(){
int T;
scanf("%d",&T);
while(T--){
for(int i=;i<=;i++){
scanf("%d %d",&a[i].width,&a[i].height);
}
print();
}
return ;
}
hiho1255 Mysterious Antiques in Sackler Museum的更多相关文章
- Mysterious Antiques in Sackler Museum(判断长方形)
题目链接 参考博客Ritchie丶的博客 - UVALive 7267 Mysterious Antiques in Sackler Museum (判断长方形) 题意:大概意思就是判断四个矩形能不能 ...
- UVALive 7267 Mysterious Antiques in Sackler Museum (判断长方形)
Sackler Museum of Art and Archaeology at Peking University is located on a beautiful site near the W ...
- UVaLive 7267 Mysterious Antiques in Sackler Museum (if-else,枚举)
题意:给定四个矩形,要求从中选出三个,能不能拼成一个矩形. 析:说到这个题,我还坑了队友一次,读题读错了,我直接看的样例,以为是四个能不能组成,然后我们三个就拼命想有什么简便方法,后来没办法了,直接暴 ...
- 【hihocoder1255 Mysterious Antiques in Sackler Museum】构造 枚举
2015北京区域赛现场赛第2题. 题面:http://media.hihocoder.com/contests/icpcbeijing2015/problems.pdf OJ链接:http://hih ...
- 2015北京区域赛 Mysterious Antiques in Sackler Museum 几何基础+思维
题意是,选出三个,看看是否可以凑成一个新的矩形. #include<bits/stdc++.h> using namespace std; struct node { ]; }a[]; b ...
- 院校-美国:哈佛大学(Harvard University)
ylbtech-院校-美国:哈佛大学(Harvard University) 哈佛大学(Harvard University),简称“哈佛”,坐落于美国马萨诸塞州波士顿都市区剑桥市,是一所享誉世界的私 ...
- 每日英语:Nanjing's New Sifang Art Museum Illustrates China's Cultural Boom
In a forest on the outskirts of this former Chinese capital, 58-year-old real-estate developer Lu Ju ...
- 【转】get a mysterious problem,when i use HttpWebRequest in unity c# script
in script,i use HttpWebRequest to get service from network.but it comes a mysterious problem. the so ...
- D - Mysterious Present
这个题和求最长递增序列的题类似,为了能输出一组可行的数据,我还用了一点儿链表的知识. Description Peter decided to wish happy birthday to his f ...
随机推荐
- python全栈开发慕课网
前端 web框架: flask:简单.轻量.灵活性大 (官网,stck overflowa); 目录结构:配置,发布,资源,日志,测试... 前后端协作:整体发布,前后端分离发布 django:简单, ...
- c++入门之const初步理解
关于const,首先建立这样的一个认识:const并不是定义了一个常量,而是定义了在某种环境下只读的变量.下面我们来区分一些东西: ; const int*p = # *p = ; i ...
- IP核引发的关于定,浮点数的认识
上面是一段关于CORDIC_IP测试文件,用于计算给定角度的sin值和cos值,关于数值表示规则在此不再重复,仅仅说明以下3点: 1 数采用原码,反码,补码,本身并没有正确与否之分(这一点很重要,我 ...
- iOS-拍照后裁剪,不可拖动照片的问题
2016.07.08 15:04* 字数 1837 阅读 6066评论 6喜欢 26赞赏 1 问题 在项目中,选择照片或拍照的功能很长见,由于我之前采用系统自带的UIimagePickViewCont ...
- 多线程系列之八:Thread-Per-Message模式
一,Thread-Per-Message模式 翻译过来就是 每个消息一个线程.message可以理解为命令,请求.为每一个请求新分配一个线程,由这个线程来执行处理.Thread-Per-Message ...
- ansible jenkins war
Ansible is Simple IT Automationhttps://www.ansible.com/ Ansible中文权威指南- 国内最专业的Ansible中文官方学习手册http://a ...
- mysql异常:Packet for query is too large (10240 > 1024). You can change this value
出现这个问题的原因是:mysql的配置文件中 max_allowed_packet 设置过小,mysql根据配置文件会限制server接受的数据包大小. 还有人会说我操作的数据量明显没有超过这个值为啥 ...
- Windows 禁止 chrome 自动更新的方法
来源: https://www.cnblogs.com/zhouwanqiu/p/9329134.html 公司进行兼容性测试 需要chrome的浏览器版本, 但是 公司网络抽风 偶尔 总能是升级到最 ...
- MQ4入门篇(一)
写一个下单功能,和一个平仓功能: 下单: 1:下单使用到的函 int OrderSend(string symbol, int cmd, double volume, double price, in ...
- Docker安装部署redis
借鉴博客:https://my.oschina.net/u/3489495/blog/1825335 待续... >>>>>>>>>docker安 ...