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> #include<math.h> void main() { long a[16][3],i,min=255*255*255,b[100][3],k,p,t; for(i=0;i<=15;i++) { cin>>a[i][0]; cin>>a[i][1]; cin>>a[i][2]; } do{ for(k=0;k<=99;k++) { cin>>b[k][0]; cin>>b[k][1]; cin>>b[k][2]; } } while((b[k][0]!=-1)&&(b[k][1]!=-1)&&(b[k][2]!=-1)); for(k=0;k<=99;k++) for(i=0;i<=15;i++) { p=(b[k][0]-a[i][0])*(b[k][0]-a[i][0])+(b[k][1]-a[i][1])*(b[k][1]-a[i][1])+(b[k][2]-a[i][2])*(b[k][2]-a[i][2]); if(p<min) { min=p; t=k; } cout<<"("<<b[k][0]<<","<<b[k][1]<<","<<b[k][2]<<")"<<"maps to"<<"("<<a[t][0]<<","<<a[t][1]<<","<<a[t][2]<<")"<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator