POJ 1046
#include<iostream>
using namespace std; #define MAXN 16
#define inf 100000000 struct node
{
int x;
int y;
int z;
}; node _m[MAXN]; int main()
{
//freopen("acm.acm","r",stdin);
int i;
int x;
int y;
int z;
int min;
int tem;
int ans;
for(i = ; i < ; ++ i)
{
cin>>_m[i].x>>_m[i].y>>_m[i].z;
}
while(cin>>x>>y>>z)
{
min = inf;
if(x == - && y == - && z == -)
{
break;
}
for(i = ; i < ; ++ i)
{
tem = (x - _m[i].x)*(x - _m[i].x) + (y - _m[i].y)*(y - _m[i].y) + (z - _m[i].z)*(z - _m[i].z);
if(tem < min)
{
ans = i;
min = tem;
}
}
cout<<"("<<x<<","<<y<<","<<z<<") maps to ("<<_m[ans].x<<","<<_m[ans].y<<","<<_m[ans].z<<")"<<endl;
}
}
关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。

技术网站地址: vmfor.com
POJ 1046的更多相关文章
- POJ 1046 Color Me Less 最详细的解题报告
题目来源:POJ 1046 Color Me Less 题目大意:每一个颜色由R.G.B三部分组成,D=Math.sqrt(Math.pow((left.red - right.red), 2)+ M ...
- poj 1046 ——Color Me Less
提交地址:http://poj.org/problem?id=1046 Color Me Less Time Limit: 1000MS Memory Limit: 10000K Total Su ...
- poj 1046 Color Me Less
Color Me Less Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 33007 Accepted: 16050 D ...
- POJ 1046 Color Me Less(浅水)
一.Description A color reduction is a mapping from a set of discrete colors to a smaller one. The sol ...
- [ACM] POJ 1046 Color Me Less
Color Me Less Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 30146 Accepted: 14634 D ...
- 【BZOJ】【1046】/【POJ】【3613】【USACO 2007 Nov】Cow Relays 奶牛接力跑
倍增+Floyd 题解:http://www.cnblogs.com/lmnx/archive/2012/05/03/2481217.html 神题啊= =Floyd真是博大精深…… 题目大意为求S到 ...
- POJ题目排序的Java程序
POJ 排序的思想就是根据选取范围的题目的totalSubmittedNumber和totalAcceptedNumber计算一个avgAcceptRate. 每一道题都有一个value,value ...
- POJ 题目分类(转载)
Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...
- (转)POJ题目分类
初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. ...
随机推荐
- 更新vs2017 15.9.2后,在指定-T v141_xp情况下载编译会报下面warning MSB8051
更新vs2017 15.9.2后,在指定-T v141_xp情况下载编译会报下面warning: C:\Program Files (x86)\Microsoft Visual Studio\2017 ...
- 2018.09.15 poj1734Sightseeing trip(floyd求最小环)
跟hdu1599差不多.. 只是需要输出方案. 这个可以递归求解. 代码: #include<iostream> #include<cstdio> #include<cs ...
- yii2 控制器的生命周期
控制器生命周期 http://www.yii-china.com/doc/guide/structure_controllers.html 处理一个请求时,应用主体 会根据请求路由创建一个控制器,控制 ...
- 23. Man and His Natural Habitat 人类及其自然栖息地
. Man and His Natural Habitat 人类及其自然栖息地 ① Ecology is that branch of science which concerns itself wi ...
- [K8S]kubeadm国内镜像安装方式
使用国内镜像站 sudo apt-get update && sudo apt-get install -y apt-transport-https curl sudo curl -s ...
- linux中nfs启动报rpcbind.socket failed to listen on sockets: Address family not supported by protocol
1.systemctl start rpcbind.service 报错: [root@autodeploy ~]# journalctl -xe -- Support: http://lists.f ...
- 优秀前端工程师必备: 非常常用的checkbox的骚操作---全选和单选demo
提要: 前端开发的时候, 经常会遇到表格勾选, 单个勾选判断是否全选的事情.趁着有时间, 总结一下以备不时之需! 就像下面这个栗子: 1 源代码: h5 // 全选框 <input type=& ...
- where /group by/ having/ order by/
1.order by 是 按字段 进行排序.. 字段后面可跟 desc 降序..asc 升序..默认为升序2.group by 是进行分组 查询3.having 和 where 都属于 条件过滤 区别 ...
- ROM初始化HEX文件
intel hex格式 记录格式 Intel HEX由任意数量的十六进制记录组成.每个记录包含5个域,它们按以下格式排列: :llaaaatt[dd...]cc 每一组字母对应一个不同的域,每一个字母 ...
- 关闭父类弹出的ifream窗口
parent.document.getElementById('zhuce').style.display = 'none';