結果

問題 No.345 最小チワワ問題
コンテスト
ユーザー HIROPON87069639
提出日時 2016-02-27 14:59:43
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
WA  
実行時間 -
コード長 440 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 73 ms
コンパイル使用メモリ 80,896 KB
実行使用メモリ 81,024 KB
最終ジャッジ日時 2026-07-18 03:31:21
合計ジャッジ時間 3,630 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# -*- coding: utf-8 -*-
S = raw_input()
Slist = list(S)
N = len(Slist)
lencww = str("inf")
flag = 0
c = -1
for i in range(0,N):
    if Slist[i] == "c":
        c = i
    if flag % 2 == 0 and 0 <= c < i and Slist[i] == "w":
        flag += 1
    elif flag % 2 == 1 and 0 <= c < i and Slist[i] == "w":
        flag += 1
        tmp = i - c + 1
        if tmp < lencww:
            lencww = tmp
if 1 < flag:
    print lencww
else:
    print -1
0