zoj 1067 Color Me Less
来源:互联网 发布:linux vi使用 编辑:程序博客网 时间:2024/04/28 10:53
#include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>#include <string>#include <cmath>#include <vector>#include <queue>#include <climits>#include <stack>#include <algorithm>using namespace std;struct color{ int r, p, g;}map[20];int i;int main(){ for(i = 1; i <= 16; i++) { scanf("%d%d%d", &map[i].r, &map[i].p, &map[i].g); } color c; while(scanf("%d%d%d", &c.r, &c.p, &c.g) && c.r >= 0) { float MIN = 195076; int index = 0; for(i = 1; i <= 16; i++) { float tmp = (map[i].r - c.r)*(map[i].r - c.r)+ (map[i].p - c.p)*(map[i].p - c.p)+ (map[i].g - c.g)*(map[i].g - c.g); if(tmp < MIN) { MIN = tmp; index = i; } } printf("(%d,%d,%d) maps to ", c.r, c.p, c.g); printf("(%d,%d,%d)\n", map[index].r, map[index].p, map[index].g); } return 0;}
注意输出格式,网站上的显示不清楚,复制到记事本上就清楚了,输出格式错误的话,给的结果是wa
- ZOJ-1067-Color Me Less
- zoj 1067 Color Me Less
- ZOJ 1067Color Me Less
- zoj 1067 Color Me Less
- ZOJ 1067 Color Me Less
- zoj 1067 Color Me Less
- ZOJ 1067 Color Me Less
- ZOJ 1067 :Color Me Less
- zoj--1067--Color Me Less
- zoj 1067 Color Me Less
- zoj 1067 Color Me Less
- zoj 1067 Color Me Less
- zoj 1067 Color Me Less
- ZOJ--1067:Color Me Less
- Solution of ZOJ 1067 Color Me Less
- php - zoj 1067 Color Me Less
- ZOJ Problem Set - 1067 Color Me Less
- ZOJ Problem Set - 1067 Color Me Less
- hello_world-1.0之原始的内核模块编程
- MySQL函数
- 上海泛微软件有限公司笔试之体验
- mongodb源码分析(三)mongo的启动
- Havok 最新DEMON的编译无法通过的原因
- zoj 1067 Color Me Less
- 韩顺平_轻松搞定网页设计(html+css+javascript)_第27讲_js一维数组_一维数组细节_学习笔记_源代码图解_PPT文档整理
- 记录安装oracle的那些事(四)之oracle 缺包安包
- Java中GridBagLayout布局
- .NET生成随机数
- android Calendar.MONTH Time.MONTH 少一个月
- cocos2d-x 使用UIWebView加载网页
- 黑马程序员——反射
- 机器学习 cs229学习笔记6(增强学习 reinforcement learning,MDP)