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> int main(){ int a[17],b[17],c[17]; int p,q,r,i,d=0,dmin=255*255*255,index; for(i=1;i<=16;i++){ scanf("%d %d %d",&a[i],&b[i],&c[i]); } scanf("%d %d %d",&p,&q,&r); while(p!=-1&&q!=-1&&r!=-1){ for(i=1;i<=16;i++){ d=(a[i]-p)*(a[i]-p)+(b[i]-q)*(b[i]-q)+(c[i]-r)*(c[i]-r); if(d<dmin){ dmin= d; index=i; } } printf("(%d,%d,%d) maps to (%d,%d,%d)\n",p,q,r,a[index],b[index],c[index]); scanf("%d %d %d",&p,&q,&r); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator