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 |
谁能帮我改改?#include<stdio.h> #include<math.h> void main(){ int R,G,B,i,j,a[16][3]; float D[16],min; for(i=0;i<16;i++){ for(j=0;j<3;j++){ scanf("%d",&a[i][j]); } } scanf("%d %d %d",&R,&G,&B); while(R!=-1&&G!=-1&&B!=-1){ for(i=0;i<16;i++){ D[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]); min=D[0]*D[0]; if( D[i]*D[i]<=min)min=D[i]*D[i]; } 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