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

Re:g++ 不能用long double 否则 WA 用double 才可以 c++无所谓

Posted by mengfei2011 at 2013-05-04 14:46:08 on Problem 2242
In Reply To:g++ 不能用long double 否则 WR 用double 才可以 c++无所谓 Posted by:mengfei2011 at 2013-05-04 14:42:58
> #include <iostream>
> #include <cmath>
> using namespace std;
> int main()
> {
> 	long double x1,x2,x3,y1,y2,y3,a,b,c,perimeter,s,aver;
> 	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3)
> 	{
> 		a =sqrt( (x1-x2 )*(x1-x2) + (y1-y2)*(y1-y2) );
> 		b =sqrt( (x1-x3 )*(x1-x3) + (y1-y3)*(y1-y3) );
> 		c =sqrt( (x3-x2 )*(x3-x2) + (y3-y2)*(y3-y2) );
> 		aver = (a+b+c) / 2.0 ;
> 		s = sqrt(  aver*(aver-a)*(aver-b)*(aver-c)  );
> 		perimeter = 3.141592653589793 * a * b * c / (2 * s);
> 		cout.setf(ios::fixed);
> 		cout.precision(2);
> 		cout << perimeter << 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