POJ-1046
来源:互联网 发布:labp是网络管理协议 编辑:程序博客网 时间:2024/05/22 03:29
#include<iostream>#include<cmath>#include<list>using namespace std;typedef struct coordinate{int x;int y;int z;}SCoordinate;typedef struct input{SCoordinate cTarget;SCoordinate cInput;}SInput;int main(int argc, char *argv[]){list<SCoordinate> mListTarget;list<SInput> mListInput;SCoordinate mCoordinate;SInput mInput;int distence;for(int i=0;i<16;i++){cin>>mCoordinate.x>>mCoordinate.y>>mCoordinate.z;mListTarget.push_back(mCoordinate);}while(1){cin>>mInput.cInput.x>>mInput.cInput.y>>mInput.cInput.z;if(mInput.cInput.x==-1 &&mInput.cInput.y==-1 &&mInput.cInput.z==-1){break;}distence=255*255*3+1;for(list<SCoordinate>::iterator iter=mListTarget.begin();iter!=mListTarget.end();++iter){int tmpDistence=sqrt(pow(1.0*mInput.cInput.x-iter->x,2)+pow(1.0*mInput.cInput.y-iter->y,2)+pow(1.0*mInput.cInput.z-iter->z,2));if(distence>tmpDistence){mInput.cTarget.x=iter->x;mInput.cTarget.y=iter->y;mInput.cTarget.z=iter->z;distence=tmpDistence;}}mListInput.push_back(mInput);}for(list<SInput>::iterator iter=mListInput.begin();iter!=mListInput.end();++iter){cout<<"("<<iter->cInput.x<<","<<iter->cInput.y<<","<<iter->cInput.z<<") maps to ("<<iter->cTarget.x<<","<<iter->cTarget.y<<","<<iter->cTarget.z<<")"<<endl;}return 0;}
0 0
- POJ-1046
- POJ 1046
- POJ 1046
- POJ-1046
- poj 1046
- poj 1046
- POJ-1046
- POJ-1046
- POJ 1046
- poj 1046
- POJ 1046 解题报告
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- Android去掉头部标题
- 2015071104 - 盘山真的那么好吗?
- makefile教程
- Linux 大规模请求服务器连接数相关设置
- HDU 1723-Distribute Message-dp-(有向图路径模型)
- POJ-1046
- Java——IO流读写对象及流操作规律
- char*,const char*,char[],string之间的转换问题。
- web.xml文件中的通配符问题
- 2015071105 - 互联网对出租车的冲击
- JDK环境变量配置
- Makefile经典教程(掌握这些足够)
- C# 中的委托和事件
- WampServer无法访问localhost