結果
問題 | No.345 最小チワワ問題 |
ユーザー |
![]() |
提出日時 | 2016-02-26 23:37:40 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 282 bytes |
コンパイル時間 | 588 ms |
コンパイル使用メモリ | 6,948 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 11:26:53 |
合計ジャッジ時間 | 1,705 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
INF = 1e+9 + 7ans = INFs = raw_input()n = len(s)for i in xrange(n):if s[i] != "c":continuecnt = 0for j in xrange(i+1, n):if s[j] == "w":cnt += 1if cnt == 2:breakif cnt == 2:ans = min(ans, j-i+1)if ans == INF:ans = -1print ans