(UVA)1587Box
来源:互联网 发布:帝国坟场 阿富汗 知乎 编辑:程序博客网 时间:2024/06/05 16:36
给定六个面判断能否构成一个长方体;搞清面与面之间的关系即可;
#include <cstdio>#include <algorithm>using namespace std;struct Rec{ int w,h; Rec(){} Rec(int ww,int hh):w(ww),h(hh){} bool operator<(const Rec &other)const{ if(w==other.w)return h<other.h; return w<other.w; } bool operator==(const Rec &other)const{ if(w==other.w&&h==other.h)return true; return false; }}rec[6];bool ok(){ for(int i=0;i<3;i++) if(rec[2*i]==rec[2*i+1])continue; else return false; if(rec[0].h==rec[2].h&&rec[0].w==rec[4].h&&rec[2].w==rec[4].w)return true; return false;}int main(){ while(scanf("%d%d",&rec[0].w,&rec[0].h)!=EOF){ for(int i=1;i<6;i++)scanf("%d%d",&rec[i].w,&rec[i].h); for(int i=0;i<6;i++)if(rec[i].h>rec[i].w)swap(rec[i].w,rec[i].h); sort(rec,rec+6); if(ok())printf("POSSIBLE\n"); else printf("IMPOSSIBLE\n"); }}
0 0
- uva 1587 - Box
- uva 1587 - Box
- UVa 1587 - Box
- UVa 1587 - Box
- UVa 1587 Box
- Uva-1587-Box-AC
- UVA - 1587 Box
- UVa 1587 Box
- Box UVa 1587
- UVA - 1587 Box 麻烦
- UVa 1587 - Box
- UVa 1587 - Box
- UVa-1587 - Box
- UVa 1587 Box
- Uva - 1587 - Box
- UVA - 1587 Box
- UVA 1587 BOX
- UVa 1587 BOX
- HBuilder webApp开发(七)微信/QQ/新浪/腾讯微博分享
- Problem H: 2.4.5 Fractions to Decimals 分数化小数
- 正则表达式 - 运算符优先级
- 【t1】·badboy跟jmeter结合的网页参数化测试(pigeon详细说)
- Leetcode题解 83. Remove Duplicates from Sorted List
- (UVA)1587Box
- WAMPServer更改web根目录
- 咖啡图库
- Swift通过类名创建对象
- 正则表达式 - 匹配规则
- LeetCode题解-82-Remove Duplicates from Sorted List II
- 策略模式(Strategy) Java 计算器加减法抽象
- (二)JavaScript中的面对对象
- Android Scroll分析(三)----Scroller