結果
問題 | No.345 最小チワワ問題 |
ユーザー |
![]() |
提出日時 | 2019-11-29 09:17:04 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 463 bytes |
コンパイル時間 | 314 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-20 21:16:03 |
合計ジャッジ時間 | 2,138 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
text = input() super_index = [i for i, c in enumerate(text) if c == 'c'] cww_len = [] for i in range(len(super_index)): cur_index = super_index[i] + 1 w_count = 0 while cur_index < len(text): if text[cur_index] == 'w': w_count += 1 if w_count == 2: cww_len.append(cur_index - super_index[i] + 1) break cur_index += 1 if len(cww_len) == 0: print(-1) else: print(min(cww_len))