Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing each type of a truck. The code is simply a string of exactly seven lowercase letters (each letter on each position has a very special meaning but that is unimportant for this task). At the beginning of company's history, just a single truck type was used but later other types were derived from it, then from the new types another types were derived, and so on.
Today, ACM is rich enough to pay historians to study its history. One thing historians tried to find out is so called derivation plan -- i.e. how the truck types were derived. They defined the distance of truck types as the number of positions with different letters in truck type codes. They also assumed that each truck type was derived from exactly one other truck type (except for the first truck type which
F - Truck History
最新推荐文章于 2020-03-20 16:51:30 发布
该问题探讨了Advanced Cargo Movement公司卡车类型的衍生历史。给定每种卡车类型的代码,目标是找到最佳的衍生计划,即最小化类型间的差异。通过计算字符串中不同字母的数量来定义类型间的距离,并应用Prim算法寻找最短路径,以最大化历史质量。输入包含多个测试用例,每个用例包含卡车类型的数量和其代码,最后以0结束。输出为最高可能的质量分数,以1/Q的形式给出。
摘要由CSDN通过智能技术生成