HBC237664疯狂的自我检索者,数学,概率期望,贪心Typewriter题解 (每日一词:jerry)

柳絮泡泡 算法基础篇 41 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
p coins to append an arbitrary single letter to the back, or. q coins to copy a substring that has already been outputted and paste it in the back.Jerry now wants to write a letter to Tom. The letter is a string. S which contains only lowercase Latin letters. But as Jerry is not very wealthy, he wants to know the minimum number of coins he needs to write this letter.

One day, Jerry found a strange typewriter. This typewriter has 2 input modes: pay p p coins to append an arbitrary single letter to the back, or q q coins to copy a substring that has already been outputted and paste it in the back. Jerry now wants to write a letter to Tom. The letter is a string S S which contains only lowercase Latin letters. But as Jerry is not very wealthy, he wants to know the minimum number of coins he needs to write this letter.

HBC237664疯狂的自我检索者,数学,概率期望,贪心Typewriter题解
(每日一词:jerry)-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC237664疯狂的自我检索者 数学 概率期望 贪心Typewriter题解