自己设计的一道ACM风格的程序设计训练题:大货车极限送货

本文探讨了物流配送场景下的路线优化问题,从简单的两点间最短路径到多点、多车的复杂配送方案,旨在减少油耗并提高配送效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最复杂版(可能NP,未证明):

A company has a central warehouse and a N clients that have to be supplied from that warehouse. A fleet of trucks is a available with T different trunks there which they don't share the same speed. And there are P pathes arround your company and clients, the distances of them are known. A truck can supply various clients on a single route. However, the total distance a truck is allowed to cover C is bounded.

You must arrange the route for your fleet to get a minimal total distance since the petrol is getting more and more expensive. Do remember truncks must return to your warehouse after they finished their jobs. Once the total distance is setted, you must make full use of your fleet to get a minimal cast time which is the time by which the last client is served.

All trunks started from the warehouse.

At least a solution is guaranteed.

Input:

First line 3 space seperated integers N,T,P mean number of clients, number of truncks, number pathes seperately.

The following T lines each contains 2 integer which means the speed and distance capacity of a trunk.

The following P lines each contains 3 integer (s,t,d) which means the distance from s to t is d.

(The index of the warehouse is 0, the other clients are represented as 1,2,3,...,P.)

Output:

Two integer:

Minimal total distance and minimal cast time of the distance.

 

下面从最简单开始逐步递增难度,并给出解题思路,供新手练习,大家交流使用。

 

最简单版:

你有一个配送公司,公司有一个仓库在A点,你有一辆卡车用来把货物从仓库送到一个客户(在B点)手里。公司附近的地图是已知的,从A点到B点之间你可能需要走到其他节点中转,你需要设计一个线路使总行驶距离最短。

 

思路:最短路径算法

 

第二版:

送到之后要返回公司。

 

思路:2次最短路径算法

 

(to be continued)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值