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 cor[3][3],deman[2][3],a[2][3]; int D[2][3],min; int k,i,t=0; for(i=0;i<3;i++) scanf("%d %d %d",&cor[i][0],&cor[i][1],&cor[i][2]); for(k=0;k<2;k++) scanf("%d %d %d",&cor[k][0],&cor[k][1]),&cor[k][2]; for(k=0;k<2;k++){ if(deman[k][0]!=-1 && deman[k][1]!=-1 && deman[k][2]!=-1){ for(i=0;i<3;i++) D[k][i]=(deman[k][0]-cor[i][0])*(deman[k][0]-cor[i][0])+(deman[k][1]-cor[i][1])*(deman[k][1]-cor[i][1])+(deman[k][2]-cor[i][2])*(deman[k][2]-cor[i][2]); for(i=0,min=D[k][0];i<3;i++){ if(min>D[k][i]){ min=D[k][i]; t=i; } } a[k][0]=cor[t][0]; a[k][1]=cor[t][1]; a[k][2]=cor[t][2]; printf("(%d %d %d) maps to (%d %d %d)\n",deman[k][0],deman[k][1],deman[k][2],a[k][0],a[k][1],a[k][2]); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator