Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我的程序计算结果都对,也可以以-1结束,为什么是WRONG ANSWER呢?谢谢帮助~

Posted by 90405125 at 2004-12-19 17:02:13 on Problem 1046
#include<stdio.h>
#include<math.h>
void main(){
	int a,b,c,m[16][3],min,i,j,t;
	for(i=0;i<16;i++){
		scanf("%d %d %d",&m[i][0],&m[i][1],&m[i][2]);
	}
	for(j=0;;j++){
		scanf("%d %d %d",&a,&b,&c);
		if(a==-1) break;
		min=(a-m[0][0])*(a-m[0][0])+(b-m[0][1])*(b-m[0][1])+(c-m[0][2])*(c-m[0][2]);
		for(i=0;i<16;i++){
			
			if((a-m[i][0])*(a-m[i][0])+(b-m[i][1])*(b-m[i][1])+(c-m[i][2])*(c-m[i][2])<=min){
min=(a-m[i][0])*(a-m[i][0])+(b-m[i][1])*(b-m[i][1])+(c-m[i][2])*(c-m[i][2]);
t=i;
			

			
			}
		}
		
		if(a!=-1)
			printf("(%d,%d,%d) maps to (%d,%d,%d)\n",a,b,c,m[t][0],m[t][1],m[t][2]);
		
	}
		
	
	
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator