博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj2826 An Easy Problem?!
阅读量:4547 次
发布时间:2019-06-08

本文共 1384 字,大约阅读时间需要 4 分钟。

题目描述:

题解:

这道题告诉我们POJ的数据是极强的……

计算几何。

有好几个特殊情况,都在这组数据里面。

106259 2664 8292 9080 1244 2972 9097 96800 1 1 01 0 2 10 1 2 11 0 1 20 0 10 100 0 9 80 0 10 100 0 8 90.9 3.1 4 00 3 2 20 0 0 20 0 -3 21 1 1 40 0 2 31 2 1 40 0 2 30 0 1 10 0 1 2
数据

感谢,

代码:

#include
#include
#include
#include
using namespace std;const double eps = 1e-8;int dcmp(double x){ if(fabs(x)<=eps)return 0; return x>0?1:-1;}struct Point{ double x,y; Point(){} Point(double x,double y):x(x),y(y){} Point operator + (const Point&a)const{
return Point(x+a.x,y+a.y);} Point operator - (const Point&a)const{
return Point(x-a.x,y-a.y);} Point operator * (const double&a)const{
return Point(x*a,y*a);} double operator ^ (const Point&a)const{
return x*a.y-y*a.x;}}a,b,c,d;typedef Point Vector;struct Line{ Point p; Vector v; Line(){} Line(Point p,Vector v):p(p),v(v){}}s,t;int n;bool diff(Line l,Point a,Point b){ return dcmp(l.v^(a-l.p))*(l.v^(b-l.p))<=0;}Point L_L(Line a,Line b){ double t = ((b.p-a.p)^b.v)/(a.v^b.v); return a.p+a.v*t;}Point L_Y(Line a,double y){ return a.p+a.v*((y-a.p.y)/a.v.y);}void work(){ scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&a.x,&a.y,&b.x,&b.y,&c.x,&c.y,&d.x,&d.y); if(a.y
View Code

 

转载于:https://www.cnblogs.com/LiGuanlin1124/p/10981956.html

你可能感兴趣的文章
中文词频统计及词云制作
查看>>
python面试题No5
查看>>
BeanShell PreProcessor数据base64加密
查看>>
10条建议帮助你创建更好的jQuery插件
查看>>
setPreferredSize和setSize的区别及用法
查看>>
Python简介及编码
查看>>
[转]Android:Layout_weight的深刻理解
查看>>
监听键盘弹出 隐藏
查看>>
iOS开发 - NSBundle, NSDevice, NSLocale
查看>>
innerHtml安全问题
查看>>
UVA 11992,。。。伪-二维线段树
查看>>
[原创]通过函数指针实现事件消息处理
查看>>
IE下JS保存图片
查看>>
293.Flip Game
查看>>
uvaLive5713 次小生成树
查看>>
mysql原生语句基础知识
查看>>
Ubuntu11搭建QT开发环境
查看>>
深度学习样本不均衡问题解决
查看>>
Servlet中Web.xml的配置详解
查看>>
RabbitMQ headers Exchange
查看>>