| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
到底那里错了,我百思不得其解,那位天才帮帮忙,小妹不胜感激. sophie#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator