UVa1587-Box
来源:互联网 发布:顾比均线的通达信源码 编辑:程序博客网 时间:2024/05/16 15:19
UVa1587-Box
思路:
判断条件略多,要想能拼成长方体六个面要满足一下几点儿
- 六个面中要有相同的三组对立面
- 假设面ABC的边分别是X,Y(X<=Y),则三组对立面满足
- A.x==B.x
- A.y==C.y
- B.y==C.x
这样就是可以拼成盒子的条件,处理一下数据排序,if比较即可
代码:
#include <bits/stdc++.h>using namespace std;pair<int,int> a[6];int cmp(pair<int,int> a,pair<int,int> b){ if(a.first==b.first) return a.second<b.second; return a.first<b.first;}int main(){ int flag=1; while(~scanf("%d %d",&a[0].first,&a[0].second)) { for(int i=1;i<6;i++) scanf("%d %d",&a[i].first,&a[i].second); for(int i=0;i<6;i++) { if(a[i].first>a[i].second) { int t=a[i].first; a[i].first=a[i].second; a[i].second=t; } } sort(a,a+6,cmp); if(a[0].first==a[1].first&&a[0].second==a[1].second&& a[2].first==a[3].first&&a[2].second==a[3].second&& a[4].first==a[5].first&&a[4].second==a[5].second&& a[0].first==a[2].first&&a[0].second==a[4].first&& a[2].second==a[4].second) printf("POSSIBLE\n"); else printf("IMPOSSIBLE\n"); } return 0;}
阅读全文
0 0
- Uva1587 - Box
- uva1587 - Box
- UVa1587-Box
- [UVA1587]BOX
- uva1587 - Box
- UVa1587 - Box
- UVa1587-Box
- uva1587——box
- UVa1587——Box
- UVa1587 Box(排序)
- UVA1587 UVALive3214 POJ2160 Box
- 盒子Box UVA1587
- 3.10 Box UVA1587
- ???习题3-10 UVa1587 Box
- Box, ACM/ICPC NEERC 2004, UVa1587
- 读程序 UVA1587 UVALive3214 POJ2160 Box
- UVa1587--Box--盒子(代码超简洁)
- Box, ACM/ICPC NEERC 2004, UVa1587
- Ubuntu16.04系统下安装OpenCV3.2.0
- 常用SQL语句
- 迭代子模式
- hexo的next百度统计
- 网络请求UI自动切换框架
- UVa1587-Box
- 题目3:统计0~n中有多少个9
- hexo的next主题打赏
- Matlab在最优化计算中的应用
- Qt openGL 使用QImage 生成二维纹理
- hexo的next主题常用设置
- Hdu6068 Classic Quotation(2017多校第4场)
- Java学习第十八天
- netty创建udp客户端