結果

問題 No.346 チワワ数え上げ問題
ユーザー rocoder
提出日時 2017-07-07 03:05:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 751 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 12,260 KB
最終ジャッジ日時 2024-10-06 04:12:11
合計ジャッジ時間 2,638 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

S=list(input())
i=0
while i<len(S)-1:
 #   print (S)
    if S[i]=="c":
   #     print (i)
        Co=[]
        while i<len(S):
    #        print (i)
            cc=0
            while i<len(S) and S[i]!="w":
                if S[i]=="c":
                    cc+=1
                i+=1
            Co.append(cc)
            cw=0
            while i<len(S) and S[i]!="c":
                if S[i]=="w":
                    cw+=1
                i+=1
            Co.append(cw)
        i+=1
    i+=1
#print (Co)
Sc=0
if len(Co)>1:
    St=len(Co)
    if len(Co)%2==1:
        St-=1
else:
    St=0
Nw=0
if St>2 and Co[St-1]==1 :
    Nw+=1
    St-=2
while St>1:
    Nw+=Co[St-1]
    Nw1=Nw-1
    Nw1*=Nw
    Nw1//=2
    Sc+=Nw1*Co[St-2]
    St-=2
print (Sc)
0