結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2019-03-30 15:33:21 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 544 bytes |
コンパイル時間 | 115 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-15 16:54:00 |
合計ジャッジ時間 | 2,099 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 14 |
ソースコード
# -*- coding: utf-8 -*- s = list(input()) findc = True findFW = False findSW = False first = 0 end = 0 ans = 999999 for i in range(len(s)): if findc: if s[i] == "c": first = i findc = False findFW = True elif findFW: if s[i] == "w": findFW = False findSW = True elif findSW: if s[i] == "w": end = i findSW = False findc = True ans = min(ans,end-first+1) if ans == 999999: ans = -1 print(ans)