UVa.1587
来源:互联网 发布:淘宝会员折扣没有了 编辑:程序博客网 时间:2024/06/05 10:25
今天效率好差好差的,不爽
这题就是判断给出的六个面能否组成长方体
1.判断能否两两对称
2.判断对称的三个面中能否组成长方体(正方体也可以)
以上
#include<stdio.h>#include<string.h>#include<algorithm>#include<iostream>//using namespace std;char *ans[2]={"POSSIBLE","IMPOSSIBLE"};char *ansb[1010];int jud[6];int wh[6][3],newwh[4][3];bool ok(){if(newwh[0][0]==newwh[2][0] && newwh[0][1]==newwh[1][1] && newwh[1][0]==newwh[2][1])return true;if(newwh[0][0]==newwh[2][0] && newwh[0][1]==newwh[1][0] && newwh[1][1]==newwh[2][1])return true;if(newwh[0][0]==newwh[1][0] && newwh[0][1]==newwh[2][1] && newwh[1][1]==newwh[2][0])return true;if(newwh[0][0]==newwh[1][0] && newwh[0][1]==newwh[2][0] && newwh[1][1]==newwh[2][1])return true;if(newwh[1][0]==newwh[2][0] && newwh[0][0]==newwh[1][1] && newwh[0][1]==newwh[2][1])return true;if(newwh[1][0]==newwh[2][0] && newwh[0][0]==newwh[2][1] && newwh[0][1]==newwh[1][1])return true;if(newwh[0][0]==newwh[1][0] && newwh[1][0]==newwh[2][0] && newwh[2][0]==newwh[0][1] && newwh[0][1]==newwh[12][1] && newwh[1][1]==newwh[2][1])return true;return false;}int main(){int sb=0;while(scanf("%d %d",&wh[0][0],&wh[0][1])!=EOF){if(wh[0][0]>=wh[0][1]){int t=wh[0][0];wh[0][0]=wh[0][1];wh[0][1]=t;}for(int i=1;i<6;i++){//这里输入六组数据scanf("%d %d",&wh[i][0],&wh[i][1]);//这里让每组数据都按从小到大的顺序排列if(wh[i][0]>=wh[i][1]){int t=wh[i][0];wh[i][0]=wh[i][1];wh[i][1]=t;}}int t=0;for(int i=0;i<6;i++){for(int j=i+1;j<6;j++){if(wh[i][0]==wh[j][0]&&wh[i][1]==wh[j][1]){newwh[t][0]=wh[i][0];newwh[t][1]=wh[i][1];t++;}}}if(t<=3){ansb[sb]=ans[1];sb++;break;;}if(ok()){ansb[sb]=ans[0];sb++;break;}else ansb[sb]=ans[1];sb++;break;}for(int bs=0;bs<sb;bs++){printf("%s\n",ansb[bs]);}return 0;}
0 0
- UVa.1587
- UVA-1587
- UVA 1587
- UVa 1587
- UVa 1587
- 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
- 检查内存泄露
- 进程-process
- 获取当前应用是否在前台显示的两种方法
- HttpServlet的两个Service()方法区别
- 【map练习】【map+模拟】codevs1164 统计数字题解
- UVa.1587
- Oracle 11g安装图文攻略
- LeetCode---Palindrome Linked List
- 广度优先搜索
- HTML页面不同数据格式之间的渲染
- PyQt 界面控件常用积累
- 怎样理解阻塞非阻塞与同步异步的区别
- POJ1681 Painter's Problem 高斯消元+枚举
- 深入了解css的行高Line Height属性