UVa 476 - Points in Figures: Rectangles
来源:互联网 发布:php数组中删除指定元素 编辑:程序博客网 时间:2024/06/06 07:19
题目:点在矩形内判断。
分析:简单题、计算几何。与两个顶点比较在顶点之间即可。
注意:在边上的不算。
#include <iostream>#include <cstdlib>#include <cstdio>using namespace std;typedef struct pnode{double x,y;}point;typedef struct rnode{point p1,p2;}rect;rect R[11];int main(){char c;int count = 0,t = 1;while ( cin >> c && c != '*' ) {cin >> R[count].p1.x >> R[count].p1.y>> R[count].p2.x >> R[count].p2.y;count ++;}point p;while ( cin >> p.x >> p.y ) {if ( p.x == 9999.9 && p.y == 9999.9 ) break;int flag = 0;for ( int i = 0 ;i < count ; ++ i )if ( R[i].p1.x < p.x && R[i].p2.x > p.x && R[i].p2.y < p.y && R[i].p1.y > p.y ) {flag = 1;printf("Point %d is contained in figure %d\n",t,i+1);}if ( !flag )printf("Point %d is not contained in any figure\n",t);t ++;}return 0;}
- UVa 476 - Points in Figures: Rectangles
- UVA 478 Points in Figures: Rectangles, Circles, and Triangles
- UVa 478 - Points in Figures: Rectangles, Circles, Triangles
- UVa 477 - Points in Figures: Rectangles and Circles
- UVA 478 Points in Figures: Rectangles…(判定点在多边形内)
- figures
- UVA 11345 Rectangles
- UVA - 10574 Counting Rectangles
- UVa 460 - Overlapping Rectangles
- UVa 10574 - Counting Rectangles
- uva 10574 - Counting Rectangles(计数)
- UVa 10295 - Hay Points
- UVA 6859 Points
- good points in papers
- (intermediate)2-SAT UVA 11930 Rectangles
- UVA 10574 - Counting Rectangles(枚举+计数)
- uva 10574 - Counting Rectangles (离散化)
- UVA 11930 - Rectangles(2-sat + 计算几何)
- vmware虚拟机使用记录
- Nginx:承受3万并发连接数,胜过Apache 10倍
- Amber12发布了
- 华为,工资岗位揭秘 2010年08月02日
- postgresql 热备份和恢复
- UVa 476 - Points in Figures: Rectangles
- Ubuntu文件属性
- CSS学习中十条速记口诀
- 林志炫-离人
- nginx 查看 并发连接数
- 串口通信与并口通信的浅理解
- PHP 编程规范! 尤其注意的几个问题
- 结束进程树
- 双指针的作用和用法