結果

問題 No.2076 Concon Substrings (ConVersion)
ユーザー lam6er
提出日時 2025-04-16 15:30:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 81,784 KB
実行使用メモリ 63,172 KB
最終ジャッジ日時 2025-04-16 15:35:40
合計ジャッジ時間 2,687 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 9 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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

runs = []
current_run = 0
i = 0

while i <= len(s) - 3:
    if s[i] == 'c' and s[i+1] == 'o' and s[i+2] == 'n':
        current_run += 1
        i += 3
    else:
        if current_run > 0:
            runs.append(current_run)
            current_run = 0
        i += 1

if current_run > 0:
    runs.append(current_run)

total_steps = 0

for m in runs:
    current = m
    steps = 0
    turn = A
    while True:
        if current >= turn:
            steps += 1
            current -= turn
            turn = B if turn == A else A
        else:
            break
    total_steps += steps

print(total_steps)
0