結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
|
提出日時 | 2017-07-20 05:23:43 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 341 bytes |
コンパイル時間 | 526 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-10-08 16:17:14 |
合計ジャッジ時間 | 2,317 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 13 |
ソースコード
S=input() stack='' i=j=0 ans=len(S) #print(ans) while i<len(S): while j<len(S): x=S[i:j] if x.count('c')>=1 and x.count('w')>=2 and x.index('c')<x.index('w'): i+=1 ans=min(ans,len(x))#update else: # print(x,ans) j+=1 i+=1 if ans==len(S):print(-1) else:print(ans)