poj1269
来源:互联网 发布:linux log4j 中文乱码 编辑:程序博客网 时间:2024/06/05 02:46
Source Code
Problem: 1269 User: PraesidioMemory: 156K Time: 0MSLanguage: C++ Result: Accepted- Source Code
#include <cstdio>const double eps=1e-8;struct point{double x,y;point() {}point(double _x,double _y) : x(_x),y(_y) {}};double operator * (point A,point B) {return (A.x*B.y-A.y*B.x);}double operator ^ (point A,point B){return (A.x*B.x+A.y*B.y);}point operator - (point A,point B){return point(A.x-B.x,A.y-B.y);}int n;int x1,y1,x2,y2;int sgn(double d){return (d>eps?1:(d<-eps?-1:0));} int main(){scanf("%d",&n);printf("INTERSECTING LINES OUTPUT\n");for (int i=0;i<n;i++) {point a[5];int x,y;for (int j=1;j<=4;j++) {scanf("%d%d",&x,&y);a[j]=point(x,y);}double d1,d2;d1=(a[2]-a[1])*(a[3]-a[1]);d2=(a[2]-a[1])*(a[4]-a[1]);if (sgn(d1-d2)==0) {if ((a[1].y-a[2].y)*(a[1].x-a[3].x)-(a[1].y-a[3].y)*(a[1].x-a[2].x)==0)printf("LINE\n");else printf("NONE\n"); continue;}point node=point((a[3].x*d2-a[4].x*d1)/(d2-d1) , (a[3].y*d2-a[4].y*d1)/(d2-d1));printf("POINT %.2lf %.2lf\n",node.x,node.y);}printf("END OF OUTPUT\n");return 0;}
0 0
- poj1269
- poj1269
- POJ1269
- poj1269
- poj1269
- POJ1269(判断线段相交)
- 计算几何POJ1269
- POJ1269 Intersecting Lines
- POJ1269- Intersecting Lines
- Intersecting Lines(poj1269)
- poj1269 直线求交点
- poj1269直线交点
- POJ1269 Intersecting Lines
- POJ1269 Intersecting Lines
- [poj1269]:Intersecting Lines
- 【计算几何】 poj1269 Intersecting Lines
- poj1269 简单的计算几何
- poj1269(计算几何+直线位置)
- .net 未知的服务器标记错误
- 动态内存管理详解:malloc/free/new/delete/brk/mmap(介绍的很明白)
- 关于cocos2d移植到Android上Android.mk需要手动增加cpp文件的问题
- C#windows窗体根据默认浏览器打开网页
- 动态申请二维数组(二)
- poj1269
- Android设计为不同的屏幕开发教程
- Xcode5 SVN
- IOS的底层视频捕获接口
- poj3304
- MIPI DSI协议介绍 .
- liferay6.1之在portal-ext.properties中定义常量
- 程序函数与数学函数概念的区别
- python中自定义函数的使用