帮忙翻译一下这道题

来源:百度知道 编辑:UC知道 时间:2024/09/22 03:01:51
Broken Necklace
You have a necklace of N red, white, or blue beads (3<=N<=350) some of which are red, others blue, and others white, arranged at random.

The beads considered first and second in the text that follows have been marked in the picture.

The configuration in Figure A may be represented as a string of b's and r's, where b represents a blue bead and r represents a red one, as follows: brbrrrbbbrrrrrbrrbbrbbbbrrrrb .

Suppose you are to break the necklace at some point, lay it out straight, and then collect beads of the same color from one end until you reach a bead of a different color, and do the same for the other end (which might not be of the same color as the beads collected before this).

Determine the point where the necklace should be broken so that the most number of beads can be collected. Example

For example, for the necklace in Figure A, 8 beads can be collected, with the breaking point ei

残破的项链
你有一个项链的N红色,白色,蓝色珠( 3 “为N ” = 350 )其中有些是红色,蓝色等,和其他白人,随机安排。

珠子第一次和第二次审议的案文中如下已标示的图片。

配置在图A可派代表作为字符串B的和R的,在那里b系蓝色珠子和R代表红色,具体情况如下: brbrrrbbbrrrrrbrrbbrbbbbrrrrb 。

假设你正在打破项链在某些时候,它奠定了直,然后收集珠相同颜色的一端,直到您达到珠不同颜色的,做相同的另一端(可能不相同颜色的珠子收集在本) 。

确定地步项链应当打破这样,最多的珠子可以收集。例如

例如,对于项链在图A , 8颗珠子可以收集,与断裂点之间的珠子或者9和珠子10或者24日之间的珠子和珠子25 。

在一些项链,白色珠子已列入图所示上文B 。收集珠,白色的珠子是遇到可能被视为要么红色或蓝色,然后画上想要的颜色。字符串,代表此配置将包括三个符号研究, B和瓦特

编写程序来确定人数最多的珠子,可以收集到供应项链