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 |
how to do#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator