結果

問題 No.345 最小チワワ問題
ユーザー fumofumofunifumofumofuni
提出日時 2021-09-14 20:54:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 75,588 KB
最終ジャッジ日時 2023-09-09 19:29:59
合計ジャッジ時間 4,584 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,260 KB
testcase_01 AC 75 ms
71,256 KB
testcase_02 AC 75 ms
71,232 KB
testcase_03 AC 75 ms
71,232 KB
testcase_04 AC 76 ms
71,080 KB
testcase_05 AC 75 ms
71,012 KB
testcase_06 AC 74 ms
71,052 KB
testcase_07 AC 76 ms
70,960 KB
testcase_08 AC 75 ms
71,164 KB
testcase_09 AC 77 ms
71,228 KB
testcase_10 AC 79 ms
75,572 KB
testcase_11 AC 78 ms
75,588 KB
testcase_12 AC 79 ms
75,524 KB
testcase_13 AC 79 ms
75,324 KB
testcase_14 AC 80 ms
75,520 KB
testcase_15 AC 80 ms
75,440 KB
testcase_16 AC 76 ms
71,008 KB
testcase_17 AC 76 ms
71,060 KB
testcase_18 AC 77 ms
71,332 KB
testcase_19 AC 76 ms
70,912 KB
testcase_20 AC 78 ms
71,312 KB
testcase_21 AC 82 ms
71,388 KB
testcase_22 AC 79 ms
70,940 KB
testcase_23 AC 77 ms
71,076 KB
testcase_24 AC 79 ms
71,228 KB
testcase_25 AC 79 ms
71,076 KB
testcase_26 AC 77 ms
71,144 KB
testcase_27 AC 77 ms
70,908 KB
testcase_28 AC 77 ms
71,320 KB
testcase_29 AC 79 ms
71,024 KB
testcase_30 AC 76 ms
71,192 KB
testcase_31 AC 77 ms
71,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ans=1000000
s=input()
for i in range(len(s)):
    res=0
    for j in range(i,len(s)):
        if res==2 and s[j]=='w':
            ans=min(ans,j-i+1)
            break
        elif res==1 and s[j]=='w':
            res+=1
        elif res==0 and s[j]=='c':
            res+=1
if ans>1000:
    print(-1)
else:
    print(ans)
0