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 hzoi_hexing at 2014-02-01 19:13:51 on Problem 2242
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define pi 3.141592653589793
double X1,Y1,X2,Y2,X3,Y3,X4,Y4;

inline double sqr(double X){
	return X*X;
} 

inline double dis(double a,double b,double c,double d){
	return sqrt(sqr(a-c) + sqr(b - d));
}

int main(){
	while (scanf("%lf%lf%lf%lf%lf%lf",&X1,&Y1,&X2,&Y2,&X3,&Y3) != EOF){
		double a = dis(X1,Y1,X2,Y2),b = dis(X1,Y1,X3,Y3),c = dis(X2,Y2,X3,Y3);		
		double p = (sqr(a) + sqr(b) + sqr(c)) / 2.0;
		double q = p - sqr(a);
		q = 1/q;
		double s = p - sqr(b);
		s = 1/s;
		q+=s;
		s = p - sqr(c);
		s = 1/s;
		q += s;
		q = 1/q;
		double r = (p - q)/4.0;
		r = sqrt(r);
		printf("%.2lf\n",2*pi*r); 
	}
	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