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 |
求助为什么是wrong answer !!!!!!!! #include <iostream> #include <math.h> using namespace std; int r[10001],g[10001],b[10001]; int main(int argc, char *argv[]) { int R[16],G[16],B[16]; for(int i=0;i<16;i++) cin>>R[i]>>G[i]>>B[i]; double d[10001]; int k=0; cin>>r[0]>>g[0]>>b[0]; while(r[k]!=-1&&g[k]!=-1&&b[k]!=-1){ int j=0; while(j<16){ d[j]=sqrt(pow(r[k]-R[j],2)+pow(g[k]-G[j],2)+pow(b[k]-B[j],2)); j++; } int c; double min=d[0]; for(int l=0;l<16;l++) { if(d[l]<min){ min=d[l]; c=l; } } printf("(%d,%d,%d) maps to (%d,%d,%d)\n",r[k],g[k],b[k],R[c],G[c],B[c]); k++; cin>>r[k]>>g[k]>>b[k]; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator