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

为什么我下面运行都对,但就是不被接受呢?求救!!!!

Posted by 90401306 at 2004-12-22 08:37:20 on Problem 1046
#include<stdio.h>

void main(){
	int r,g,b,a[16][3],i,j,k=0,n;
	 int d[16], min;
	for(i=0;i<16;i++){
		for(j=0;j<3;j++){
			scanf("%d",&a[i][j]);
		}
	}
	scanf("%d%d%d",&r,&g,&b);
	while(r!=-1&&g!=-1&&b!=-1){
	for(n=0;n<16;n++){
			d[n]=(r-a[n][0])*(r-a[n][0])+(g-a[n][1])*(g-a[n][1])+(b-a[n][2])*(b-a[n][2]);	
		  } 
			min=d[0];
	
		for(n=0;n<16;n++){
				if(d[n]<min){
				min=d[n];
				k=n;
			}
		}
		printf("(%d,%d,%d)maps to(%d,%d,%d)\n",r,g,b,a[k][0],a[k][1],a[k][2]);
		scanf("%d%d%d",&r,&g,&b);
	}
}


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