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 ...
随机推荐
- [LeetCode] Rank Scores -- 数据库知识(mysql)
Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ra ...
- haoop笔记
: //:什么是hadoop? hadoop是解决大数据问题的一整套技术方案 :hadoop的组成? 核心框架 分布式文件系统 分布式计算框架 分布式资源分配框架 hadoop对象存储 机器计算 :h ...
- Java 学习使用常见的开源连接池
目录 连接池介绍 自定义连接池 JDBC Tomcat Pool DBCP(DataBase Connection Pool) 使用配置文件来设置DBCP C3P0 Druid 连接池介绍 在说连接池 ...
- Use the Microsoft Symbol for VS and Windbg
快捷方式mklink的远程符号由于所有者权限问题,链接到本地可能造成不能使用, 或每次都需要重新下载, 1.环境变量中没有设置_NT_SYMBOL_PATH的值 2.windbg快捷方式中也没有设置- ...
- Cannot connect to database because the database client
问题描述: arcgis server10.1 arcgis sde10出现下面问题 Cannot connect to database because the database client ...
- js原生实现div渐入渐出
jq对渐入渐出进行封装,简单的使用连个方法就可以实现.fadeIn(),fadeOut();如果我们界面没有使用jq那么原生怎么实现呢? 我们讲解一下,这个原理.当我们要实现渐入的时候,首先是让隐藏的 ...
- composer更改源为国际
composer config -g repo.packagist composer https://repo.packagist.org
- @PathVariable
@PathVariable是用来对指定请求的URL路径里面的变量 eg: Java代码 @RequestMapping(value = "form/{id}/apply", met ...
- 建议1---理解Pythonic的概念
对于Pythonic的概念,众人都有自己的看法,但大家心中都认同一个更具体的指南,即Tim Peters的<The Zen of Python>.在这一篇充满禅意的诗篇中,有几点非常深入人 ...
- python爬虫scrapy之登录知乎
下面我们看看用scrapy模拟登录的基本写法: 注意:我们经常调试代码的时候基本都用chrome浏览器,但是我就因为用了谷歌浏览器(它总是登录的时候不提示我用验证码,误导我以为登录时不需要验证码,其实 ...