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 ...
随机推荐
- MySQL的log_bin和sql_log_bin 的区别
利用二进制还原数据库的时候,突然有点纠结,log_bin和sql_log_bin有什么区别呢?行吧,搜搜,结合自己的经验,简单说一下.log_bin:二进制日志. 在 mysql 启动时,通过命令行或 ...
- heb Daz
Asatras soi bib Daz! gos la haik ri, dewoa gos mi haik quri. soi Fong d cuup va ti Chusan, imps Dabo ...
- Is-a
在知识表示.面向对象程序设计与面向对象设计的领域里, is-a(英语:subsumption,包含架构)指的是类的父子继承关系, 例如类D是另一个类B的子类(类B是类D的父类). 换句话说,通常&qu ...
- 自己实现数据结构系列五---BinarySearchTree
一.二分搜索树: 1.代码: public class BST<E extends Comparable<E>> { private class Node{ public E ...
- [转帖]linux下的CPU、内存、IO、网络的压力测试
linux下的CPU.内存.IO.网络的压力测试 https://www.cnblogs.com/zhuochong/p/10185881.html 一.对CPU进行简单测试: 1.通过bc命令计算特 ...
- [转帖]PAT 计算机程序设计能力考试
PAT 计算机程序设计能力考试 https://blog.csdn.net/bat67/article/details/52134211 [官方简介] 计算机程序设计能力考试(Programming ...
- 基于vue-cli,sass,vant的移动端项目
项目架构 开始 vue init webpack 项目名称 //新建项目,cd进入新项目 npm install axios //先安装! ...
- vue中的跨域问题
https://segmentfault.com/a/1190000011072725(原文) 使用vue-axios和vue-resource解决vue中调用网易云接口跨域的问题 注(api很重 ...
- day 7-5 生产者消费者模型
一. 生产者和消费者模型 在并发编程中使用生产者和消费者模式能够解决绝大多数并发问题.该模式通过平衡生产线程和消费线程的工作能力来提高程序的整体处理数据的速度. 二. 为什么要使用生产者和消费者模式 ...
- 修改tomcat控制台title的方法
修改tomcat控制台title的方法,参考:http://www.jspkongjian.net/news.jsp?id=1125,具体如图: