結果

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

ソースコード

diff #

#関数をなるべく使おう
def main():
    s=input()
    flg=0
    pri(s,flg)

def pri(s,flg):
    for i in range(len(s)):
        if s[i]=="c":
            f=i
            flg=1
        elif s[i]=="w" and flg==1:
            flg=2
        elif s[i]=="w" and flg==2:
            flg=3
            e=i
    if flg==3:
        print(e-f+1)
    else:
        print(-1)
    
if __name__=="__main__":
    main()
0