-
算法实现题2
算法实现题2-3 邮局选址问题
« 问题描述:
在一个按照东西和南北方向划分成规整街区的城市里,n个居民点散乱地分布在不同的
街区中。用x 坐标表示东西向,用y坐标表示南北向。各居民点的位置可以由坐标(x,y)表示。
街区中任意2 点(x1,y1)和(x2,y2)之间的距离可以用数值|x1-x2|+|y1-y2|度量。
居民们希望在城市中选择建立邮局的最佳位置,使n个居民点到邮局的距离总和最小。
« 编程任务:
给定n 个居民点的位置,编程计算n 个居民点到邮局的距离总和的最小值。
« 数据输入:
由文件input.txt 提供输入数据。文件的第1 行是居民点数n,1£ n£ 10000。接下来n 行
是居民点的位置,每行2 个整数x 和y,-10000£ x,y£ 10000。
« 结果输出:
程序运行结束时,将计算结果输出到文件output.txt 中。文件的第1 行中的数是n 个居
民点到邮局的距离总和的最小值。
输入文件示例 输出文件示例
input.txt output.txt
5
1 2
2 2
1 3
3 -2
3 3
10
- 2022-08-26 13:24:17下载
- 积分:1
-
VB文档和源代码,做过。
VB documentation and good souce code that is ever done.
- 2023-03-19 09:10:04下载
- 积分:1
-
WPF 对话框创建在模型视图查看模型模式
这些代码实际上封装模态对话框创建在 Windows 演示文稿的基础。
通过使用此代码之一可以创建
消息框
打开文件对话框
文件夹浏览器对话框
模态对话框与自定义类型
- 2022-09-21 20:50:03下载
- 积分:1
-
12cengdianti chengxu sun sunsun
12cengdianti chengxu sun sun -12cengdianti chengxu sun sunsun
- 2022-02-11 16:48:04下载
- 积分:1
-
Change XP serial number. Zip to c hange XP serial number. Zip to change XP seria...
Change XP serial number. Zip to c hange XP serial number. Zip to change XP serial number. Zip-Change XP serial number. Zip to change XP serial number. Zip to change XP serial number. Zip to change XP serial number. Zip
- 2022-10-25 13:15:04下载
- 积分:1
-
vb 大学学习的实验作业里面有文件复制
其他还有一些练习
vb 大学学习的实验作业里面有文件复制
其他还有一些练习-vb University experimental operations inside files There are several exercises
- 2022-03-05 08:02:33下载
- 积分:1
-
用VS.NET 2003开发的一个伟大的C++软件,帮助很多初学者。快点…
一个C++的好程序,对起步的同学有很大的帮助,是用 vs.net 2003 编得,大家快来下载,真的很不错哦!-a great C++ softwre developed with VS.net 2003, help a lot for beginners. Hurry to downnload, it s not bad!
- 2022-06-30 21:30:02下载
- 积分:1
-
Chinese chess. The project is in Visual Studio.net 2003 built under Win32 consol...
中国象棋。该项目系在Visual Studio.net 2003下所建的Win32控制台项目(使用其它版本的编译器只需新建一个Win32控制台项目,然后逐一加入所有的.cpp文件和.h文件即可),其目的只是简单地测试引擎。因而该程序不提供用户着法的合法性检测,以及棋局的结束处理等。
下棋方式:
用户按输入起点坐标、终点坐标的方式下棋;
(棋盘左下角计作(0,0),右上角计作(8,9))
同样,程序反馈起点坐标、终点坐标作为计算机方的走棋行为。
例如:
用户第一步走:炮二平五
则输入7242,回车
计算机回应:马8进7
则屏幕输出79 67
-Chinese chess. The project is in Visual Studio.net 2003 built under Win32 console project (using the other version of the compiler simply create a new Win32 console project, and then adding one by one all. Cpp files and. H file can be), its The purpose of simply testing the engine. Thus the program does not provide users with the legitimacy of law detection, and treatment, such as the end game. Play chess the way: the user input according to the starting point coordinates, end coordinates of the way a game of chess (lower left-hand corner of the chessboard for the (0,0), the upper right corner of dollars for (8,9)) Similarly, the starting point coordinates of the feedback process, the end o
- 2023-01-15 21:45:03下载
- 积分:1
-
这本书就不用再介绍了吧,经典中的经典。适合进阶的C++程序员。...
这本书就不用再介绍了吧,经典中的经典。适合进阶的C++程序员。-This book will not need to re-introduce the bar, the classic of classics. Suitable for advanced C++ Programmers.
- 2022-03-26 03:13:21下载
- 积分:1
-
voice codec plugin for winamp.
selever api 帮助文档 大家来下啊-Help selever api to everyone under the ah
- 2022-11-22 15:35:03下载
- 积分:1