HBC51460Chuanpai,思维Crazy Binary String题解

凉芷 算法基础篇 53 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
ZYB loves binary strings (strings that only contains `0' and `1'). And he loves equalbinarystringstextit{equal binary strings}equalbinarystrings more, where the number of `0' and the number of `1' in

ZYB loves binary strings (strings that only contains `0' and `1'). And he loves equal binary stringstextit{equal binary strings}equal binary strings more, where the number of `0' and the number of `1' in the string are equal. ZYB wants to choose a substring from an original string  T T T so that it is an equal binary stringtextit{equal binary string}equal binary string with the longest length possible. He also wants to choose a subsequence of  T T T which meets the same requirements. A string  v v v is a substring of a string  w w w if  v v v is empty, or there are two integers  l l l and r (1≤l≤r≤∣w∣)r (1 le l le r le |w|)r (1≤l≤r≤∣w∣) such that v=wlwl+1⋯wrv=w_lw_{l+1}cdots w_rv=wl​wl+1​⋯wr​. A string  v v v is a subsequence of a string  w w w  if it can be derived from  w w w  by deleting any number (including zero) of characters without changing the order of the remaining characters.  For simplicity, you only need to output the maximum possible length. Note that the empty string is both a substring and a subsequence of any string.

HBC51460Chuanpai,思维Crazy Binary String题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC51460Chuanpai 思维Crazy Binary String题解