結果

問題 No.345 最小チワワ問題
ユーザー polygon283polygon283
提出日時 2023-09-04 22:54:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 499 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 8,032 KB
最終ジャッジ日時 2023-09-04 22:54:03
合計ジャッジ時間 2,188 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 WA -
testcase_03 RE -
testcase_04 WA -
testcase_05 WA -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 15 ms
7,952 KB
testcase_13 RE -
testcase_14 WA -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 RE -
testcase_21 RE -
testcase_22 WA -
testcase_23 RE -
testcase_24 RE -
testcase_25 WA -
testcase_26 WA -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def min_chiwawa_length(s):
    min_len = len(s) + 1
    
    
    for i in range(len(s)):
        if s[i] == 'c':

            first_w = s.find('w',i)
            if first_w == -1:
                break
            second_w = s.find('w',first_w + 1)
            if second_w == -1:
                break

        length = second_w - i + 1
        min_len = min(min_len,length)

    if min_len == len(s) + 1:
        return -1
    else:
        return min_len
s = input()
print(min_chiwawa_length(s))
0