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

为什么老是WA

Posted by NENU08022 at 2009-01-15 21:18:32 on Problem 1046
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int a[16][3],b[16],c[3],i,j;
	for( i=0;i<16;i++)
		for( j=0;j<3;j++)
		     cin>>a[i][j];
	while(cin>>c[0]>>c[1]>>c[2])
	{
		int m=500;
		int num=0;
		for(i=0;i<16;i++)
		{
			b[i]=sqrt(float((c[0]-a[i][0])*(c[0]-a[i][0])+(c[1]-a[i][1])*(c[1]-a[i][1])+(c[2]-a[i][2])*(c[2]-a[i][2])));
			if(b[i]<m)
			{
				m=b[i];num=i;
			}
		}
		cout<<"("<<c[0]<<","<<c[1]<<","<<c[2]<<") maps to ("<<a[num][0]<<","<<a[num][1]<<","<<a[num][2]<<")"<<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