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

how to do

Posted by ye at 2004-11-24 19:02:22 on Problem 1046
#include<stdio.h>
#include<math.h>
main()
{
    int a[16][3],r,g,b,i;
    float A,D;
    for(i=0;i<16;i++)
        scanf("%d %d %d",a[i][3]);
    scanf("%d %d %d",&r,&g,&b);
    while(r!=-1&&g!=-1&&b!=-1){
     for(i=0;i<16;i++){
            D=(a[i][0]-r)*(a[i][0]-r)+(a[i][1]-g)*(a[i][1]-g)+(a[i][2]-b)*(a[i][2]-b);}
           A=(a[0][0]-r)*(a[0][0]-r)+(a[0][1]-g)*(a[0][1]-g)+(a[0][2]-b)*(a[0][2]-b);
        if(A>D)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