| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
各位帮我看看哪里有错啊?谢谢啦~#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator