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

到底那里错了,我百思不得其解,那位天才帮帮忙,小妹不胜感激. sophie

Posted by sophie at 2004-12-11 00:08:06 on Problem 1046
#include<math.h>
#include<stdio.h>
 void main(){
 	int R[16],G[16],B[16],i,S[16],D;
	int a,b,c,k;
 	for(i=0;i<=15;i++)
 		scanf("%d%d%d",&R[i],&G[i],&B[i]);
 	scanf("%d%d%d",&a,&b,&c);
	while(a!=-1&&b!=-1&&c!=-1)
 	{ 
		for(i=0;i<=15;i++){
			S[i]=((a-R[i])*(a-R[i])+(b-G[i])*(b-G[i])+(c-B[i])*(c-B[i]));
		}
		for(D=S[0],i=0,k=0;i<=15;i++)
			if(S[i]<D){	
				S[i]=D;	k=i;
			}
        printf("(%d,%d,%d) maps to (%d,%d,%d)\n",a,b,c,R[k],G[k],B[k]);
 		
 	scanf("%d%d%d",&a,&b,&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