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 070824204 at 2008-12-18 20:59:10 on Problem 3348
#include<iostream.h>
#include<cmath>
int main()
{
	int i,j,n,g;
	long double x,y,z,m=0.0,area=0,s=0,a[10000][3];
	cin>>n;
	for(i=0;i<n;i++)
	{	for(j=0;j<2;j++)
		{
		cin>>a[i][j];
		}
	}
	for(i=2;i<n;i++)
	{
		x=sqrt((a[i-1][0]-a[0][0])*(a[i-1][0]-a[0][0])+(a[i-1][1]-a[0][1])*(a[i-1][1]-a[0][1]));
		y=sqrt((a[i][0]-a[0][0])*(a[i][0]-a[0][0])+(a[i][1]-a[0][1])*(a[i][1]-a[0][1]));
		z=sqrt((a[i][0]-a[i-1][0])*(a[i][0]-a[i-1][0])+(a[i][1]-a[i-1][1])*(a[i][1]-a[i-1][1]));
		s=(1.0/2)*(x+y+z);
		area=sqrt(s*(s-x)*(s-y)*(s-z));
		m+=area;
	}
//	cout<<m<<endl;
	g=(int)m/50;
	cout<<g<<endl;
	return 1;
}

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