結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー lam6er
提出日時 2025-03-31 17:47:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 82,600 KB
実行使用メモリ 65,600 KB
最終ジャッジ日時 2025-03-31 17:48:25
合計ジャッジ時間 2,631 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 9 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

n, A, B = map(int, input().split())
S = input().strip()

runs = []
i = 0
len_S = len(S)
while i <= len_S - 3:
    if S[i] == 'c' and S[i+1] == 'o' and S[i+2] == 'n':
        count = 1
        j = i + 3
        while j <= len_S - 3:
            if S[j] == 'c' and S[j+1] == 'o' and S[j+2] == 'n':
                count += 1
                j += 3
            else:
                break
        runs.append(count)
        i = j
    else:
        i += 1

total = 0
for m in runs:
    ab = A + B
    full = m // ab
    rem = m % ab
    total += full * 2 + (1 if rem >= A else 0)

print(total)
0