結果

問題 No.345 最小チワワ問題
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-02-26 23:15:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 349 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 9,964 KB
最終ジャッジ日時 2023-10-24 06:13:15
合計ジャッジ時間 2,675 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,964 KB
testcase_01 AC 30 ms
9,964 KB
testcase_02 AC 30 ms
9,964 KB
testcase_03 AC 30 ms
9,964 KB
testcase_04 AC 30 ms
9,964 KB
testcase_05 WA -
testcase_06 AC 30 ms
9,964 KB
testcase_07 AC 30 ms
9,964 KB
testcase_08 AC 30 ms
9,964 KB
testcase_09 AC 30 ms
9,964 KB
testcase_10 AC 30 ms
9,964 KB
testcase_11 AC 30 ms
9,964 KB
testcase_12 AC 30 ms
9,964 KB
testcase_13 AC 30 ms
9,964 KB
testcase_14 AC 30 ms
9,964 KB
testcase_15 AC 31 ms
9,964 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 30 ms
9,964 KB
testcase_20 AC 30 ms
9,964 KB
testcase_21 AC 29 ms
9,964 KB
testcase_22 AC 30 ms
9,964 KB
testcase_23 AC 29 ms
9,964 KB
testcase_24 AC 29 ms
9,964 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 30 ms
9,964 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 30 ms
9,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import re


def solve(s):
    pattern = re.compile(r"c.*?w.*?w")
    matches = re.findall(pattern, s)
    if not matches:
        return -1
    else:
        cands = [match.strip("c") for match in matches]
        return min(map(len, cands)) + 1


if __name__ == '__main__':
    print(solve(input()))
0