UVA7267 Mysterious Antiques in Sackler Museum (强行模拟)
来源:互联网 发布:百视通网络电视直播 编辑:程序博客网 时间:2024/06/05 10:21
the link is here
this question need a lot consideration ,witch five us 4 rectangles and let us to check if there exist three of them that can from a rectangle
because there ‘re only 4 ,we can iter any formation of the four rectangle and see if they can line up in a rectangle or one of them can match line up with other two
this take me really time to finish up so I should do more complicated question to speed up my code speed
#include <iostream>#include<cstdio>#include<cstring>#include<vector>#include<map>using namespace std;struct rec{ int x,y; int s;}z[5];bool check(int a,int b,int c,int t){ int mx = 0; for(int i = 0;i<=8;i++) { int t1 = (i&1) ? z[a].x : z[a].y; int y1 = (i&1) ? z[a].y : z[a].x; int t2 = ((i>>1)&1) ? z[b].x : z[b].y; int y2 = ((i>>1)&1) ? z[b].y : z[b].x; int t3 = ((i>>2)&1) ? z[c].x : z[c].y; int y3 = ((i>>2)&1) ? z[c].y : z[c].x; //printf("%d %d %d\n",t1,t2,t3); if(t1 == t2 && t1 == t3) { if(mx < (z[a].s + z[b].s + z[c].s)) { mx = z[a].s + z[b].s + z[c].s; } //printf("") } if(t1 + t2 == t3 && y1 == y2) { if(mx < (z[a].s + z[b].s + z[c].s)) { mx = z[a].s + z[b].s + z[c].s; } } if(t2 + t3 == t1 && y2 == y3) { if(mx < (z[a].s + z[b].s + z[c].s)) { mx = z[a].s + z[b].s + z[c].s; } } if(t1 + t3 == t2 && y1 == y3) { if(mx < (z[a].s + z[b].s + z[c].s)) { mx = z[a].s + z[b].s + z[c].s; } } } //printf("%d %d %d %d = %d\n",a,b,c,t,mx); return mx != 0;}int main(){ int ca; scanf("%d",&ca); while(ca--) { for(int i = 1;i<=4;i++) { scanf("%d%d",&z[i].x,&z[i].y); z[i].s = z[i].x*z[i].y; } if(check(1,2,3,4) || check(1,2,4,3) || check(2,3,4,1) ||check(1,3,4,2)) { printf("Yes\n"); } else { printf("No\n"); } } return 0;}
阅读全文
0 0
- UVA7267 Mysterious Antiques in Sackler Museum (强行模拟)
- hihoCoder 1255 Mysterious Antiques in Sackler Museum(水)
- UVALive 7267 Mysterious Antiques in Sackler Museum(dfs)
- hihocoder 1255 Mysterious Antiques in Sackler Museum
- 2015北京邀请赛 UVALive7267 Mysterious Antiques in Sackler Museum
- UVALive 7267Mysterious Antiques in Sackler Museum (判断长方形)
- ACM-ICPC北京赛区2015 G Mysterious Antiques in Sackler Museum hihoCoder 1255
- UVALive 7267 Mysterious Antiques in Sackler Museum 思维题 拼接矩形
- 【hihocoder1255 2015北京赛区G】【简单模拟 简化写法超棒哦】 Mysterious Antiques in Sackler Museum 四个矩形选三个 恰好拼成大矩形
- In the national museum
- HDU 2414 Chessboard Dance (强行模拟)
- hdu5920-Ugly Problem(强行模拟)
- Codeforces 598D Igor In the Museum (DFS)
- CodeForces 598 D. Igor In the Museum(dfs)
- Educational Codeforces Round 1 D. Igor In the Museum(BFS)
- Codeforces 598DIgor In the Museum (BFS加离线优化)
- D. Igor In the Museum(简单DFS)
- Codeforces 598D:Igor In the Museum
- 关于Spark里面的RDD.mappartitions的问题
- 产品经理之交互设计
- Windows打开dcm文件、dcm文件批量转其它图片文件格式
- (思考)谈谈学习这事
- 快速解决tomcat的自动加载问题!
- UVA7267 Mysterious Antiques in Sackler Museum (强行模拟)
- Spring boot快速搭建
- 指针的使用二级指针
- 远程服务器后台运行命令
- List浅拷贝,与深的拷贝探讨
- struts2笔记
- JavaScript闭包
- android拒绝来电的实现demo
- 所有博客