結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
soupesuteaka
|
| 提出日時 | 2016-03-02 16:49:50 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 2,000 ms |
| コード長 | 516 bytes |
| コンパイル時間 | 107 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-09-25 11:35:40 |
| 合計ジャッジ時間 | 2,076 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#coding: UTF-8 import sys import re import itertools from collections import deque ### defs ### def cww(s): sz = len(s) cnt=0 for c in s: if (cnt==0 and c=='c'): cnt+=1 elif (cnt==1 and c=='w'): cnt+=1 elif (cnt==2 and c=='w'): cnt+=1 if(cnt==3): res=sz else: res=-1 return res ### main ### s = sys.stdin.readline() ans = -1 sz = len(s) for i in range(sz): for j in range(i+1,sz+1): l = cww(s[i:j]) if (l > 0): if(ans < 0): ans = l else: ans = min(ans,l) print (ans)
soupesuteaka