1046 Color Me Less
来源:互联网 发布:demo制作软件 编辑:程序博客网 时间:2024/04/28 20:08
水题
- //4377084_AC_0MS_392K
- #include<iostream>
- #include<math.h>
- using namespace std;
- #define MAXINT 2147483647
- struct Color
- {
- int r,g,b;
- };
- Color c[16];
- Color temp;
- inline double dis(Color x,Color y)
- {
- return sqrt((double)(x.r-y.r)*(x.r-y.r)+(x.g-y.g)*(x.g-y.g)+(x.b-y.b)*(x.b-y.b));
- }
- int main()
- {
- while(1)
- {
- for(int i=0;i<16;++i)
- {
- if(scanf("%d%d%d",&c[i].r,&c[i].g,&c[i].b)==-1) return 0;
- }
- while(1)
- {
- scanf("%d%d%d",&temp.r,&temp.g,&temp.b);
- if(temp.r==-1&&temp.g==-1&&temp.b==-1)
- {
- break;
- }
- double m=MAXINT;
- int t;
- for(int i=0;i<16;++i)
- {
- double d=dis(temp,c[i]);
- if(d<m)
- {
- m=d;
- t=i;
- }
- }
- printf("(%d,%d,%d) maps to (%d,%d,%d)/n",temp.r,temp.g,temp.b,c[t].r,c[t].g,c[t].b);
- }
- }
- return 0;
- }
- 1046 Color Me Less
- 1046 Color Me Less
- 1046 Color Me Less
- 1046 Color Me Less
- Color Me Less--poj--1046
- pku 1046 Color Me Less
- POJ 1046 Color Me Less
- poj 1046(Color Me Less)
- 1046 poj Color Me Less
- poj 1046 Color Me Less
- <poj 1046>Color Me Less
- poj 1046 Color Me Less
- POJ 1046 Color Me Less
- HDU 1046 Color Me Less
- POJ 1046 Color Me Less
- Color Me Less POJ - 1046
- poj 1046 Color Me Less
- POJ 1046 Color Me Less
- 小佳弱弱学习——queue队列的简单实现
- 小佳弱弱学习——stack栈的简单实现
- 开机总是进行磁盘检查
- 小佳弱弱学习——tree二叉树的简单实现
- 你必须知道的C#的25个基础概念(附演示)
- 1046 Color Me Less
- 解决jQuery1.1 Ajax请求时cache的问题(转)
- 关于title或Tooltip的换行问题
- csdn的资源上传做的真垃圾!
- 关于Linux杀毒软件
- Linux系统调用--fstat/stat/lstat函数详解
- 基础资料辅助属性处理流程
- 一个IT人士的个人经历,给迷失方向的朋友
- HTML 标签的 ismap 和 usemap 属性