HBC51195定位查找,过关题目,语言题Fence题解

把回忆走一遍 算法基础篇 92 0
全网最全C++题库,助您快速提升编程技能!题库丰富多样,涵盖各个领域,让您在练习中不断成长!
A team of k workers should paint a fence which contains N planks numbered from 1 to N from left to right. Each worker i should sit in front of the plank Si and he may paint only a compact interval . This interval should contain the Si plank. Also a worker should not paint more than Li planks and for each painted plank he should receive PiP_i Pi. A plank should be painted by no more than one worker. All the numbers Si should be distinct. Being the team's leader you want to determine for each worker the interval that he should paint, knowing that the total income should be maximal. The total income represents the sum of the workers personal income. Write a program that determines the total maximal income obtained by the K workers.

A team of k (1≤K≤100)(1 leq K leq 100)(1≤K≤100) workers should paint a fence which contains N (1≤N≤16000)(1 leq N leq 16 000)(1≤N≤16000) planks numbered from 1 to N from left to right. Each worker i (1≤i≤K)(1 leq i leq K)(1≤i≤K)should sit in front of the plank Si and he may paint only a compact interval (this means that the planks from the interval should be consecutive). This interval should contain the Si plank. Also a worker should not paint more than Li planks and for each painted plank he should receive Pi(1≤Pi≤10000)P_i (1 leq P_i leq 10 000)Pi​(1≤Pi​≤10000). A plank should be painted by no more than one worker. All the numbers Si should be distinct. Being the team's leader you want to determine for each worker the interval that he should paint, knowing that the total income should be maximal. The total income represents the sum of the workers personal income. Write a program that determines the total maximal income obtained by the K workers.

HBC51195定位查找,过关题目,语言题Fence题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC51195定位查找 过关题目 语言题Fence题解