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 ...
随机推荐
- 用PhoneGap创建第一个项目
1.在eclipse中新建Android Project2.在项目的目录下,建两个文件夹:/libs/assets/www3.进入将刚刚下载并解压的PhoneGap包里Anroid目录,我们需要的资源 ...
- Jenkins部署net core小记
作为一个不熟悉linux命令的neter,在centos下玩Jenkins真的是一种折磨啊,但是痛并快乐着,最后还是把demo部署成功!写这篇文章是为了记录一下这次部署的流程,和心得体会. 网上很多资 ...
- Elasticsearch IK+pinyin
如何在Elasticsearch中安装中文分词器(IK+pinyin) 如果直接使用Elasticsearch的朋友在处理中文内容的搜索时,肯定会遇到很尴尬的问题——中文词语被分成了一个一个的汉字 ...
- Vue-router路由使用,单页面的实现
1.安装路由系统 NPM npm install vue-router 2.在main.js中进入引用 import VueRouter from 'vue-router' 3.创建三个空的组件: V ...
- node-sass下载失败 关于webpack
安装node-sass提示没有vendor目录的解决办法在node-sass目录下面新建一个vendor的空目录,然后运行npm/cnpm rebuild node-sass --save-dev即可 ...
- PhpStorm 配置链接远程虚拟机
安装好了 PhpStorm 之后,打开项目文件夹,接着点击工具栏 Tools: 2.接着点击 tools>Deployment: 3.点击Configuration 开始配置 4.填好箭头 ...
- redis设置防火墙的问题
Linux 下载安装配置Redis完整步骤 安装: 1.获取redis资源 wget http://download.redis.io/releases/redis-4.0.8.tar.gz 2. ...
- WPF中元素拖拽的两个实例
今天结合之前做过的一些拖拽的例子来对这个方面进行一些总结,这里主要用两个例子来说明在WPF中如何使用拖拽进行操作,元素拖拽是一个常见的操作,第一个拖拽的例子是将ListBox中的子元素拖拽到ListV ...
- groovy安装 ideal
参考:https://blog.csdn.net/newbie_907486852/article/details/80879745 (1) 首先下载groovy: https://gradle.or ...
- JDK 12 & JAVA
JDK 12 & JAVA js style https://github.com/winterbe https://winterbe.com/posts/2018/09/24/java-11 ...