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)递推. ...
随机推荐
- 使用reactjs做一个CRUD功能
第一步:引入reactjs所依赖的js文件,本案例使用的是bootstrap前端框架,所以引入了相应的js和css文件 第二步:body里面添加两个div 第三步:开始编写reactjs脚本 < ...
- [K8S]污点调度
如果不希望某个节点被调度可以使用以下命令进行设置 kubectl taint node master01 node-role.kubernetes.io/master="":No ...
- maven插件mybatis-generator生成代码
第一步,在pom中加入插件 <plugin> <groupId>org.mybatis.generator</groupId> <artifactId> ...
- C#基础:在using中创建对象
在using中创建的对象的类必须是实现了IDispose接口的类,示例代码如下: static void Main(string[] args) { Method(); Console.WriteLi ...
- AD采样的一个例子
用122.88k时钟采样153.6k的信号
- 关于FIR的modelsim
(1)FIR ip核仿真 (2)FIR 多通道应用 (3)多通道fir ip核需要注意的复位问题 =================================================== ...
- 揭开AutoRun功能的神秘面纱
有很多光盘放入光驱就会自动运行,它们是怎么做到的呢?光盘一放入光驱就会自动被执行,主要依靠两个文件,一是光盘上的AutoRun.inf文件,另一个是操作系统本身的系统文件之一的Cdvsd.vxd.Cd ...
- 如何开发一个产品级的Node.js 应用
介绍 Node.js是一个开源的javascript运行时环境.非常简单可以快速开发一个网络应用.这个平台运行在Linux.OSX和Windows,而且运行在这个平台上的应用都是用javascript ...
- ajax和SSH请求中乱码的一些解决方法
乱码的原因无非就是两端的编码方式不同. ajax方的编码 ajax无论是get还是post,都可以在content-type中设置charset为utf-8,或者beforesend中在sethead ...
- Fading Like a Flower
Fading Like a Flower In a time where the sun descends alone 伴着落日孤独的脚步 I ran a long long way from hom ...