HBC51630马老师,背包问题,动态规划,思维Gemstones题解

水水月牙 算法基础篇 61 0
全网最全C++题库,助您快速提升编程技能!题库丰富多样,涵盖各个领域,让您在练习中不断成长!
Gromah and LZR have entered the seventh level. There are a sequence of gemstones on the wall. After some tries, Gromah discovers that one can take exactly three successive gemstones with the same types away from the gemstone sequence each time, after taking away three gemstones, the left two parts of origin sequence will be merged to one sequence in origin order automatically. For example, as for "ATCCCTTG", we can take three 'C's away with two parts "AT", "TTG" left, then the two parts will be merged to "ATTTG", and we can take three 'T's next time. The password of this level is the maximum possible times to take gemstones from origin sequence. Please help them to determine the maximum times.

Gromah and LZR have entered the seventh level. There are a sequence of gemstones on the wall. After some tries, Gromah discovers that one can take exactly three successive gemstones with the same types away from the gemstone sequence each time, after taking away three gemstones, the left two parts of origin sequence will be merged to one sequence in origin order automatically. For example, as for "ATCCCTTG", we can take three 'C's away with two parts "AT", "TTG" left, then the two parts will be merged to "ATTTG", and we can take three 'T's next time. The password of this level is the maximum possible times to take gemstones from origin sequence. Please help them to determine the maximum times.

HBC51630马老师,背包问题,动态规划,思维Gemstones题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC51630马老师 背包问题 动态规划 思维Gemstones题解