| ||||||||||
| 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 | |||||||||
该程序可正常调试,但却通过不了,说是“RUNTIME ERROR”,这是为何,望高手们指教#include <stdio.h>
#include <math.h>
void main (){
int cc[6][3],bc[16][3],x,y,z,D[6][16],min;
int i=0,k,t=0;
for(i=0;i<16;i++)
scanf("%d %d %d",&bc[i][0],&bc[i][1],&bc[i][2]);
scanf("%d %d %d",&x,&y,&z);
while(x!=-1 && y!=-1 && z!=-1){
for(k=0;k<16;k++)
D[i][k]=(x-bc[k][0])*(x-bc[k][0])+(y-bc[k][1])*(y-bc[k][1])+(z-bc[k][2])*(z-bc[k][2]);
for(k=0,min=D[i][0];k<16;k++){
if(min>D[i][k]){
min=D[i][k];
t=k;
}
}
cc[i][0]=bc[t][0];
cc[i][1]=bc[t][1];
cc[i][2]=bc[t][2];
printf("(%d %d %d) maps to (%d %d %d)\n",x,y,z,cc[i][0],cc[i][1],cc[i][2]);
i++;
scanf("%d %d %d",&x,&y,&z);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator