結果

問題 No.345 最小チワワ問題
ユーザー temari(hadaly)
提出日時 2018-10-07 02:18:32
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-01 05:09:18
合計ジャッジ時間 2,120 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

S = list(input())
last = len(S)
chiwawa = []
for c in range(0,last):
    if 'c' in S[c]:
        for w1 in range(c+1, last):
            if 'w' in S[w1]:
                for w2 in range(w1+1, last):
                    if 'w' in S[w2]:
                        chiwawa.append(w2-c+1)
if chiwawa:
    print(min(chiwawa))
else:
    print(-1)
0