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<stdio.h> #include<math.h> void main(){ int min,l,i,j,d,a,b,c,x[16],y[16],z[16]; for(i=0;i<16;i++) { scanf("%d %d %d",&x[i],&y[i],&z[i]); } scanf("%d %d %d",&a,&b,&c); if(!(a==-1&&b==-1&&c==-1)){ min=(x[0]-a)^2+(y[0]-b)^2+(z[0]-c)^2; for(j=1;j<16;j++) { d=(x[j]-a)^2+(y[j]-b)^2+(z[j]-c)^2; if(d<=min) { min=d; l=j; } } printf("(%d,%d,%d) maps to (%d,%d,%d)\n",a,b,c,x[l],y[l],z[l]); }} 是不是l的赋值不对啊? Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator