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

发个代码

Posted by jml04 at 2010-11-30 13:57:17 on Problem 3711 and last updated at 2010-11-30 15:51:56
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	double x1,x2,x3,y1,y2,y3,h;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>h){
		double a=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
		double b=(x3-x1)*(x3-x1)+(y3-y1)*(y3-y1);
		double c=(x3-x2)*(x3-x2)+(y3-y2)*(y3-y2);
		double s=a+b+c;
		double x=(x1*c+x2*b+x3*a)/s;
		double y=(y1*c+y2*b+y3*a)/s;
		cout<<fixed<<setprecision(2)<<x<<' '<<y<<endl;
	}
	return 0;
}

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