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 Alcyone at 2004-12-01 11:51:25 on Problem 1046
In Reply To::P Posted by:scandrive at 2004-12-01 11:03:58
> 我也觉得奇怪了 V C++ 上是过了 测试都很好 就是WR…… 
> 大家帮忙看一下了……
> 
> #include<stdio.h>
> void main()
> {
>     int R,G,B,i,j,k,a[16][3];
>     long d[16];
>     for(i=0;i<16;i++)
> 	scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
>     scanf("%d %d %d",&R,&G,&B);
>     while(R!=-1&&G!=-1&&B!=-1)
>     {
>        for(i=0;i<16;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]);
> 
>        for(j=0,k=0;j<16;j++)
> 	{
> 	  if(d[j]<=d[k])==>d[j]<d[k]
> 	     k=j;
> 	}
>         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