[USACO12MAR]园林绿化Landscaping

农夫John正在建设一个花园,需要搬运大量泥土。花园包含N个花坛,每个花坛初始含A_i单位泥土,目标是让每个花坛含B_i单位泥土。他可以选择购买、移除泥土或在花坛间运输泥土,每个操作都有相应费用。题目要求计算完成园林绿化的最小总成本。输入包含花园规模、各项操作费用及每个花坛的泥土目标量,输出为最小成本。

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

题目描述

Farmer John is building a nicely-landscaped garden, and needs to move a large amount of dirt in the process.

The garden consists of a sequence of N flowerbeds (1 <= N <= 100), where flowerbed i initially contains A_i units of dirt.  Farmer John would like to re-landscape the garden so that each flowerbed i instead contains B_i units of dirt.  The A_i's and B_i's are all integers in the range 0..10.

To landscape the garden, Farmer John has several options: he can purchase one unit of dirt and place it in a flowerbed of his choice for X.Hecanre

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值