結果

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

ソースコード

diff #

S=input()
stack=''
i=j=0
ans=len(S)

found=0
while i<len(S)+1:
    while j<len(S)+1:
        x=S[i:j]
        if x.count('c')>=1 and x.count('w')>=2 and x.index('c')<x.index('w'):
            found=1
            i+=1
            ans=min(ans,len(x))#update
        else:
            j+=1
    i+=1
if found:print(ans)
else:print(-1)
0