結果

問題 No.345 最小チワワ問題
ユーザー TwizzTwizz
提出日時 2017-02-22 20:48:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 424 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 7,964 KB
最終ジャッジ日時 2023-08-29 01:30:44
合計ジャッジ時間 1,828 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,916 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 AC 16 ms
7,964 KB
testcase_03 AC 17 ms
7,784 KB
testcase_04 AC 16 ms
7,864 KB
testcase_05 AC 15 ms
7,872 KB
testcase_06 AC 16 ms
7,928 KB
testcase_07 AC 15 ms
7,856 KB
testcase_08 AC 15 ms
7,948 KB
testcase_09 AC 16 ms
7,900 KB
testcase_10 AC 16 ms
7,920 KB
testcase_11 AC 15 ms
7,872 KB
testcase_12 AC 15 ms
7,948 KB
testcase_13 AC 15 ms
7,920 KB
testcase_14 AC 16 ms
7,764 KB
testcase_15 AC 15 ms
7,820 KB
testcase_16 AC 15 ms
7,776 KB
testcase_17 AC 15 ms
7,804 KB
testcase_18 AC 15 ms
7,920 KB
testcase_19 AC 15 ms
7,840 KB
testcase_20 AC 16 ms
7,864 KB
testcase_21 WA -
testcase_22 AC 15 ms
7,956 KB
testcase_23 AC 16 ms
7,804 KB
testcase_24 AC 16 ms
7,948 KB
testcase_25 AC 16 ms
7,812 KB
testcase_26 AC 15 ms
7,900 KB
testcase_27 AC 15 ms
7,768 KB
testcase_28 WA -
testcase_29 AC 15 ms
7,900 KB
testcase_30 AC 16 ms
7,944 KB
testcase_31 AC 15 ms
7,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
min=101

if S.count("c")<1 or S.count("w")<2:
    print(-1)
else:
    for (i,x) in enumerate(S):
        if x=="c":
            count=0
            l=1

            for y in S[i+1:]:
                l+=1
                if y=="w":
                    count+=1
                    if count==2:
                        break
            if count==2:
                if l<min:
                    min=l
    print(min)
0