#abc300f. F - More Holidays
F - More Holidays
Score : points
问题描述
你得到一个长度为 的字符串 ,其中包含字符 o
和 x
,以及整数 和 。
保证字符串 中至少包含一个 x
。
令 为通过将 重复拼接 次得到的长度为 的字符串。考虑在 中恰好替换 个 x
为 o
。
你的目标是在变换后的 中得到尽可能长的连续 o
子串。
找出你能得到的最长连续 o
子串的长度。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a string of length consisting of o
and x
, and integers and .
is guaranteed to contain at least one x
.
Let be the string of length obtained by concatenating copies of . Consider replacing exactly x
's in with o
.
Your objective is to have as long a contiguous substring consisting of o
as possible in the resulting .
Find the maximum length of a contiguous substring consisting of o
that you can obtain.
Constraints
- , , and are integers.
- , where is the number of
x
's in the string . - is a string of length consisting of
o
andx
. - has at least one
x
.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
10 1 2
ooxxooooox
Sample Output 1
9
ooxxooooox
and ooxxooooox
.
Replacing x
at the third and fourth characters with o
makes ooooooooox
.
Now we have a length- contiguous substring consisting of o
, which is the longest possible.
Sample Input 2
5 3 4
oxxox
Sample Output 2
8
oxxox
and oxxoxoxxoxoxxox
.
Replacing x
at the and -th characters with o
makes oxxooooooooxxox
.
Now we have a length- contiguous substring consisting of o
, which is the longest possible.
Sample Input 3
30 1000000000 9982443530
oxoxooxoxoxooxoxooxxxoxxxooxox
Sample Output 3
19964887064
update @ 2024/3/10 08:24:49