結果

問題 No.345 最小チワワ問題
ユーザー くまちゃんくまちゃん
提出日時 2022-02-24 12:41:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 9,160 KB
最終ジャッジ日時 2023-09-15 06:50:27
合計ジャッジ時間 2,238 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
9,024 KB
testcase_01 AC 26 ms
8,944 KB
testcase_02 AC 25 ms
9,108 KB
testcase_03 AC 25 ms
9,020 KB
testcase_04 AC 25 ms
9,020 KB
testcase_05 WA -
testcase_06 AC 25 ms
9,076 KB
testcase_07 AC 25 ms
8,936 KB
testcase_08 AC 25 ms
9,004 KB
testcase_09 AC 25 ms
9,016 KB
testcase_10 AC 26 ms
9,112 KB
testcase_11 AC 25 ms
8,980 KB
testcase_12 AC 26 ms
9,028 KB
testcase_13 AC 25 ms
8,944 KB
testcase_14 WA -
testcase_15 AC 26 ms
9,004 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 25 ms
9,008 KB
testcase_20 AC 26 ms
8,972 KB
testcase_21 AC 25 ms
8,928 KB
testcase_22 AC 25 ms
9,152 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 24 ms
9,068 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 25 ms
9,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import re


def main():
    text = input()
    l = text.find('c')
    m = text.find('w', l + 1)
    n = text.find('w', m + 1)

    if text.count('c') < 1 or text.count('w') < 2:
        print(-1)
    elif text.count('c') == 1 and text.count('w') == 1:
        print(-1)
    elif l < m < n:
        patcww = re.compile(r'c.*?w.*?w')
        rescww = patcww.search(text)
        if rescww.group() == 'ccww':
            print(3)
        else:
            print(len(rescww.group()))
    else:
        print(-1)

    

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