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

有硕士博士吗,同等学力的也进来帮帮我,为什么VC能通过提交总是wrong anwser

Posted by winter_1 at 2006-04-23 22:22:27 on Problem 1046
#include<stdio.h>
void main()
{
	struct color{
		int a;
		int b;
		int c;
	};
	struct color vb[16];
	int i,k1,k2,k3,t1,t2,t3,min=0;
	for(i=0;i<16;i++){
		scanf("%d %d %d",&vb[i].a,&vb[i].b,&vb[i].c);
	}
	int x,y,z;
	while(1){
		scanf("%d %d %d",&x,&y,&z);
		if(x==-1&&y==-1&&z==-1){
			break;
		}		
		for(i=1;i<16;i++){
			k1=x-vb[min].a;
			k2=y-vb[min].b;
			k3=z-vb[min].c;
			t1=x-vb[i].a;
			t2=y-vb[i].b;
			t3=z-vb[i].c;
			if(k1*k1+k2*k2+k3*k3>t1*t1+t2*t2+t3*t3){
				min=i;
			}
		}
	
		printf("(%d,%d,%d) maps to (%d,%d,%d)\n",x,y,z,vb[min].a,vb[min].b,vb[min].c);
	
	}
}


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