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 liuhighway at 2010-03-31 00:25:00 on Problem 1046
#include<iostream>
#include<math.h>
using namespace std;
int main()
{int i,j,min,l,s,x[16]={0},y[16]={0},z[16]={0},x1[16]={0},y1[16]={0},z1[16]={0},k;double a[16]={0};
	for(i=0;i<16;i++)
{
		cin>>x[i]>>y[i]>>z[i];
	}
j=0;
while(cin>>x1[j]>>y1[j]>>z1[j]&&x1[j]!=-1&&y1[j]!=-1&&z1[j]!=-1)
{
	
j++;
}
for(k=0;k<j;k++)
{
	for(i=0;i<16;i++)
	{
		a[i]=sqrt(double((x1[k]-x[i])*(x1[k]-x[i])+(y1[k]-y[i])*(y1[k]-y[i])+(z1[k]-z[i])*(z1[k]-z[i])));
	}
	
		for(min=a[0],l=0,s=0;l<16;l++)
		{
			if(a[l]<min)
			{
				min=a[l];s=l;
			}
		}
		cout<<"("<<x1[k]<<","<<y1[k]<<","<<z1[k]<<")"<<" maps to ("<<x[s]<<","<<y[s]<<","<<z[s]<<")"<<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