結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
|
提出日時 | 2022-02-24 12:32:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 476 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-02 11:23:34 |
合計ジャッジ時間 | 1,865 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 RE * 2 |
other | AC * 16 RE * 13 |
ソースコード
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'cx*?wx*?w') rescww = patcww.search(text) print(len(rescww.group())) else: print(-1) if __name__ == '__main__': main()