-
算法实现题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
-
Realize the program automatically monitor directory changes, including whether t...
该程序实现了目录变化自动监视,包括是否添加 删除 重命名 修改了文件属性等.-Realize the program automatically monitor directory changes, including whether to add delete rename the file attributes, such as modified.
- 2022-04-10 23:05:28下载
- 积分:1
-
Prepared using VC dashboard display data source code, you can set the upper and...
用VC编写的仪表盘显示数据源代码,可设置上下限,默认值等-Prepared using VC dashboard display data source code, you can set the upper and lower limits, defaults, etc.
- 2022-02-03 20:33:17下载
- 积分:1
-
这是我很早的一个作品,是学了VB之后做的,还有很多功能没有实现,你不防接着做,内含安装程序和源代码。...
这是我很早的一个作品,是学了VB之后做的,还有很多功能没有实现,你不防接着做,内含安装程序和源代码。-This is an ealier version which is writen after learning VB. Many functions have not been carried out. If you are interested, you can further improve it. including installation and source code.
- 2022-01-22 17:08:05下载
- 积分:1
-
a simple ftp download landing procedures for the study. Development environment...
一个简单的ftp登陆下载程序,供大家学习。
开发环境:visual C++
-a simple ftp download landing procedures for the study. Development environment : visual C
- 2023-04-06 11:05:04下载
- 积分:1
-
对于VC编程很有帮助,非常好的非常好的不可见的分隔条
对于VC编程很有帮助,非常好的非常好的不可见的分隔条-for VC helpful, very good very good visibility to the separation of
- 2022-06-21 05:27:46下载
- 积分:1
-
用实例说明,普通函数、类成员函数、类静态成员函数在执行速度上的差别...
用实例说明,普通函数、类成员函数、类静态成员函数在执行速度上的差别-example, a normal function, a class member function, static member function in the implementation of the difference in speed
- 2022-04-13 04:55:50下载
- 积分:1
-
being the largest segmentation method tagging source
正向最大切分法+词性标注源码-being the largest segmentation method tagging source
- 2022-03-30 04:18:40下载
- 积分:1
-
基于VB的教师信息管理系统设计
通过用sql server编写并搭建数据库,在vb6.0上基本实现了教师信息系统的管理,包括教师的任课情况,基本信息和科研情况。
- 2022-02-20 23:17:07下载
- 积分:1
-
Template usage
Template Classes的用法-Template usage
- 2022-07-26 13:10:27下载
- 积分:1