結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2016-02-27 14:59:43 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 440 bytes |
コンパイル時間 | 138 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-24 11:38:04 |
合計ジャッジ時間 | 1,399 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 12 |
ソースコード
# -*- coding: utf-8 -*- S = raw_input() Slist = list(S) N = len(Slist) lencww = str("inf") flag = 0 c = -1 for i in range(0,N): if Slist[i] == "c": c = i if flag % 2 == 0 and 0 <= c < i and Slist[i] == "w": flag += 1 elif flag % 2 == 1 and 0 <= c < i and Slist[i] == "w": flag += 1 tmp = i - c + 1 if tmp < lencww: lencww = tmp if 1 < flag: print lencww else: print -1