結果
| 問題 | No.2076 Concon Substrings (ConVersion) | 
| コンテスト | |
| ユーザー |  gew1fw | 
| 提出日時 | 2025-06-12 18:40:46 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 549 bytes | 
| コンパイル時間 | 295 ms | 
| コンパイル使用メモリ | 82,180 KB | 
| 実行使用メモリ | 64,896 KB | 
| 最終ジャッジ日時 | 2025-06-12 18:40:54 | 
| 合計ジャッジ時間 | 2,648 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 9 WA * 19 | 
ソースコード
n, a, b = map(int, input().split())
s = input().strip()
runs = []
i = 0
while i <= len(s) - 3:
    if s[i:i+3] == 'con':
        count = 1
        i += 3
        while i <= len(s) - 3 and s[i:i+3] == 'con':
            count += 1
            i += 3
        runs.append(count)
    else:
        i += 1
total = 0
for x in runs:
    pair = a + b
    if pair == 0:
        continue  # but a and b are >=1, so this is impossible
    full_pairs = x // pair
    total += full_pairs * 2
    rem = x % pair
    if rem >= a:
        total += 1
print(total)
            
            
            
        