結果
問題 | No.345 最小チワワ問題 |
ユーザー |
|
提出日時 | 2020-10-13 13:16:49 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 412 bytes |
コンパイル時間 | 192 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-07-20 18:25:48 |
合計ジャッジ時間 | 1,880 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
# coding=utf-8: import re s = str(input()) c = re.compile(r'.*?c.*?w.*?w') if "cww" in s: print(3) elif re.search(c, s) == None: print(-1) elif len(s) >= 4: countList = list() for i in range(len(s)): temp1 = re.search(c, s[i:]) if temp1 != None: temp2 = temp1.group() countList.append(len(temp2)) else: break print(min(countList))