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 |
请哪位牛人帮忙看一下吧以下为1046的程序:在visual c++上调试都是可以过的,但不知为什么在这儿就是通不过。 请哪位好心人帮下忙吧,多谢! #include<stdio.h> #include<math.h> void main() { int a[16][3]; int i,j,b,c,n,x,y,z; int ave,index; long min; for (i=0;i<=15;i++) { scanf("%d %d %d",&x,&y,&z); a[i][0]=x; a[i][1]=y; a[i][2]=z; } while(1) { scanf("%d %d %d",&j,&b,&c); if (j==-1&&b==-1&&c==-1) break; min=1000000; for (n=0;n<=15;n++) { ave=(a[n][0]-j)*(a[n][0]-j)+(a[n][1]-b)*(a[n][1]-b)+(a[n][2]-c)*(a[n][2]-c); if (min>=ave){ min=ave; index=n;} } printf("(%d,%d,%d) maps to (%d %d %d)\n",j,b,c,a[index][0],a[index][1],a[index][2]); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator