結果

問題 No.345 最小チワワ問題
ユーザー superzugan
提出日時 2020-03-31 03:12:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 272 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-23 14:00:01
合計ジャッジ時間 2,226 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

s=input()
n=len(s)
cnt=0
ans=10000
for i in range(n):
    if s[i]=="c":
        cnt-=i
        for j in range(i+1,):
            if s[j]=="w":
                if s[j]=="w":
                    cnt+=j
                    ans=min(ans,cnt)
if ans==0:print(-1)
else:print(ans)
0