結果

問題 No.345 最小チワワ問題
ユーザー RyutoRyuto
提出日時 2018-03-31 17:38:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 71,852 KB
最終ジャッジ日時 2023-09-08 10:14:15
合計ジャッジ時間 4,536 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,372 KB
testcase_01 AC 74 ms
71,432 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 72 ms
71,376 KB
testcase_05 AC 74 ms
71,344 KB
testcase_06 AC 74 ms
71,524 KB
testcase_07 AC 74 ms
71,392 KB
testcase_08 AC 73 ms
71,484 KB
testcase_09 AC 73 ms
71,392 KB
testcase_10 AC 73 ms
71,536 KB
testcase_11 AC 72 ms
71,420 KB
testcase_12 AC 71 ms
71,404 KB
testcase_13 AC 73 ms
71,360 KB
testcase_14 AC 73 ms
71,608 KB
testcase_15 AC 73 ms
71,544 KB
testcase_16 AC 73 ms
71,360 KB
testcase_17 WA -
testcase_18 AC 73 ms
71,428 KB
testcase_19 AC 72 ms
71,500 KB
testcase_20 AC 72 ms
71,600 KB
testcase_21 AC 74 ms
71,612 KB
testcase_22 AC 73 ms
71,400 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 73 ms
71,152 KB
testcase_29 AC 73 ms
71,396 KB
testcase_30 AC 72 ms
71,460 KB
testcase_31 AC 74 ms
71,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python

def main():
    sl = list(input().strip())
    sw = 0
    ans = 0
    res = 200
    for s in sl:
        if s == 'c':
            sw = 1
            ans = 1
        elif sw == 1 and s == 'w':
            sw = 2
            ans += 1
        elif sw == 2 and s == 'w':
            sw = 0
            ans += 1
            res = min(ans, res)
        else:
            ans += 1
    if res == 200:
        print('-1')
    else:
        print(res)

if __name__ == '__main__':
    main()
0