加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

zoj 1821 || poj 1673 Exocenter of a Triangle

发布时间:2020-12-16 22:50:07 所属栏目:大数据 来源:网络整理
导读:求垂心。分类上直接说了,无语。如果我看的话应该第一反应是模拟一遍吧。。 pojdiscuss上有证明。 ZOJ死活不过,后来看大黄的题解,可能会输出-0.0000,这个。。。无语shi。。 #include map#include set#include queue#include stack#include math.h#include

求垂心。分类上直接说了,无语。如果我看的话应该第一反应是模拟一遍吧。。

pojdiscuss上有证明。

ZOJ死活不过,后来看大黄的题解,可能会输出-0.0000,这个。。。无语shi。。

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <math.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <limits.h>
#include <string.h>
#include <string>
#include <algorithm>
#define MID(x,y) ( ( x + y ) >> 1 )
#define L(x) ( x << 1 )
#define R(x) ( x << 1 | 1 )
#define BUG puts("here!!!")
#define STOP system("pause")

using namespace std;

const double eps = 1e-6;
struct point {
	double x,y;
	void get()
	{
		scanf("%lf%lf",&x,&y);
	}
};

point a,b,c;

point l2l_inst_p(point u1,point u2,point v1,point v2)
{
	point ans = u1;
	double t = ((u1.x - v1.x)*(v1.y - v2.y) - (u1.y - v1.y)*(v1.x - v2.x))/
				((u1.x - u2.x)*(v1.y - v2.y) - (u1.y - u2.y)*(v1.x - v2.x));
	ans.x += (u2.x - u1.x)*t;
	ans.y += (u2.y - u1.y)*t;
	return ans;
}
point perpencenter(point a,point b,point c)
{
	point ua,ub,va,vb;
	ua = c;
	ub.x = ua.x - a.y + b.y;
	ub.y = ua.y + a.x - b.x;
	va = b;
	vb.x = va.x - a.y + c.y;
	vb.y = va.y + a.x - c.x;
	return l2l_inst_p(ua,vb);
}

int main()
{
	int ncases;
	
	scanf("%d",&ncases);
	
	while( ncases-- )
	{
		a.get(); b.get(); c.get();
		point ans = perpencenter(a,c);
		if( fabs(ans.x) < eps ) ans.x = 0;
		if( fabs(ans.y) < eps ) ans.y = 0;
		printf("%.4lf %.4lfn",ans.x,ans.y);
	}

return 0;
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读