Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

100题留念 自己研究出计算三角形外心的超长的公式 贴代码

Posted by lin_tao at 2012-07-17 11:54:53 on Problem 2242
Program poj2242;
type
  t_v=record x,y:extended;end;
const
  pai=3.1415926535897932384626433832795028841971693993751058;
var
  v1,v2,v3,v:t_v;

function dis(v1,v2:t_v):extended;
begin
  exit(sqrt(sqr(v1.x-v2.x)+sqr(v1.y-v2.y)));
end;

procedure waixin(v1,v2,v3:t_v; var v:t_v);
var p,q,r:extended;
begin
  p:=v1.y-v2.y;
  q:=v2.y-v3.y;
  r:=v3.y-v1.y;
  v.x:=(q*(sqr(v1.x)+sqr(v1.y))+r*(sqr(v2.x)+sqr(v2.y))+p*(sqr(v3.x)+sqr(v3.y)))/(2*(v1.x*q+v2.x*r+v3.x*p));
  p:=v1.x-v2.x;
  q:=v2.x-v3.x;
  r:=v3.x-v1.x;
  v.y:=(q*(sqr(v1.x)+sqr(v1.y))+r*(sqr(v2.x)+sqr(v2.y))+p*(sqr(v3.x)+sqr(v3.y)))/(2*(v1.y*q+v2.y*r+v3.y*p));
end;

Begin
  while not eof do
  begin
    readln(v1.x,v1.y,v2.x,v2.y,v3.x,v3.y);
    waixin(v1,v2,v3,v);
    writeln(2*pai*dis(v1,v):0:2);
  end;
End.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator