結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2025-02-15 18:26:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 710 bytes |
コンパイル時間 | 466 ms |
コンパイル使用メモリ | 12,160 KB |
実行使用メモリ | 10,112 KB |
最終ジャッジ日時 | 2025-02-15 18:26:30 |
合計ジャッジ時間 | 2,966 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 14 |
ソースコード
def is_c(s: str) -> bool: return s == "c" def is_w(w: str) -> bool: return w == "w" def is_cww(start_flag: bool, w_count: int) -> bool: return w_count == 2 and start_flag def main(): S = input() ans = -1 start_flag = False tmp = 0 w_count = 0 for s in S: if is_c(s): start_flag = True tmp += 1 continue if not start_flag: continue tmp += 1 if is_w(s): w_count += 1 if is_cww(start_flag, w_count): ans = max(ans, tmp) start_flag = False tmp = 0 continue print(ans) if __name__ == "__main__": main()