結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
airis
|
| 提出日時 | 2016-02-26 23:37:40 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 86 ms / 2,000 ms |
| コード長 | 282 bytes |
| 記録 | |
| コンパイル時間 | 153 ms |
| コンパイル使用メモリ | 77,492 KB |
| 最終ジャッジ日時 | 2025-12-03 19:31:57 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
INF = 1e+9 + 7
ans = INF
s = raw_input()
n = len(s)
for i in xrange(n):
if s[i] != "c":
continue
cnt = 0
for j in xrange(i+1, n):
if s[j] == "w":
cnt += 1
if cnt == 2:
break
if cnt == 2:
ans = min(ans, j-i+1)
if ans == INF:
ans = -1
print ans
airis