POJ 1160 Post Office(区间DP)

该博客介绍了如何利用动态规划解决POJ 1160题,即在数轴上的村庄中选址建邮局,使得所有村庄到最近邮局的总距离最小。博主详细阐述了递推公式和状态转移的思想,并提供了样例解释及简化后的求解方法。
摘要由CSDN通过智能技术生成

poj 1160

Post Office

Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 21315   Accepted: 11522

Description

There is a straight highway with villages alongside the highway. The highway is represented as an integer axis, and the position of each village is identified with a single integer coordinate. There are no two villages in the same position. The distance between two positions is the absolute value of the difference of their integer coordinates.

Post offices will be built in some, but not necessarily all of the villages. A village and the post office in it have the same position. For building the post offices, their positions should be chosen so that the total sum of all distances between ea

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值