結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2019-09-18 13:56:19 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 422 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-08 02:22:05 |
合計ジャッジ時間 | 1,706 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 14 |
ソースコード
# No.345 最小チワワ問題 import sys s = input() index_c = 0 index_w = 0 count_w = 0 length = sys.maxsize for i in range(len(s)): if s[i] == 'c' and index_c == 0: index_c = i count_w = 0 elif s[i] == 'w' and i > index_c: index_w = i count_w += 1 if count_w == 2: length = min(length, index_w - index_c + 1) print(length if length != sys.maxsize else -1)