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

哪位高手帮忙看看吧!为什么在自己的机子上运行正常,系统却说wrong answer

Posted by 90401452 at 2004-11-26 19:23:30 on Problem 1046
#include<stdio.h>
#include<math.h>
void main() {
  struct color {
    int R;
    int G;
    int B;
  } output;
  struct color basecolor[16];
  int i,j,m,a,b,c,x,y,z;
  int X,D=255*255+255*255+255*255;
  for (i=1;i<=16;i++) {
  scanf("%d %d %d",&x,&y,&z);
  basecolor[i-1].R=x;
  basecolor[i-1].G=y;
  basecolor[i-1].B=z;
  }
  for (m=1;;m++) {
  scanf("%d %d %d",&a,&b,&c);
    if (a!=-1,b!=-1,c!=-1) {
      for(j=1;j<=16;j++) {
 X=(a-basecolor[j-1].R)*(a-basecolor[j-1].R)+(c-basecolor[j-1].B)*(c-basecolor[j-1].B)+(b-basecolor[j-1].G)*(b-basecolor[j-1].G);
        if (X<=D) {
	    D=X;
        output=basecolor[j-1];  
		}
      }
   printf("(%d,%d,%d) maps to (%d,%d,%d)\n",a,b,c,output.R,output.G,output.B);
    D=255*255+255*255+255*255;}
    else break;
  }
}

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