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 13lazyrainy at 2007-07-22 13:25:15 on Problem 1046
#include<iostream.h>

int main()
{
	int a[16][3];
	int t1,t2,t3,key,min;
	int dt;
	int i=0;
	while (i<16)
	{
		cin>>a[i][0]>>a[i][1]>>a[i][2];
		i++;
	}

	cin>>t1>>t2>>t3;
	while (t1!=-1||t2!=-1||t3!=-1)
	{
		min=200000;key=0;
		for (i=0;i<16;i++)
		{
			dt=(t1-a[i][0])*(t1-a[i][0])+(t2-a[i][1])*(t2-a[i][1])+(t3-a[i][2])*(t3-a[i][2]);
			if (dt<min) {min=dt;key=i;}
		}
		cout<<"("<<t1<<","<<t2<<","<<t2<<")"<<" maps to "<<"("<<a[key][0]<<","<<a[key][1]<<","<<a[key][2]<<")"<<endl;
		cin>>t1>>t2>>t3;
	}

	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