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-11-27 17:18:01 on Problem 1046
#include<stdio.h>
#include<math.h>
void main(){
	     int R,G,B,i,j,a[16][3];
		 float 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(i=0;i<16;i++){
				 D[i]*D[i]==(R-a[i][0])*(R-a[i][0])+(G-a[i][1])*(G-a[i][1])+(B-a[i][2])*(B-a[i][2]);
                 min=D[0]*D[0];
				if( D[i]*D[i]<=min)min=D[i]*D[i];
			 }
			 printf("(%d,%d,%d)maps to(%d,%d,%d)\n",R,G,B,a[i][0],a[i][1],a[i][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