結果

問題 No.345 最小チワワ問題
ユーザー maguroguma
提出日時 2017-08-11 14:10:36
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 380 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-10-12 20:35:39
合計ジャッジ時間 2,015 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

S = input()

l = -1
min_l = 101
state = 0   # 0:c探索中, 1:cセット中, 2:最後のw探索中
for c in S:
    l += 1
    if c == 'c':
        l = 1
        state = 1
    elif c == 'w' and state == 1:
        state = 2
    elif c == 'w' and state == 2:
        state = 0
        min_l = min(min_l, l)

min_l = -1 if min_l==101 else min_l

print(min_l)
0