結果

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

ソースコード

diff #

S=list(input())
i=0
while i<len(S)-3:
  #  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
#rint (Co)
Sc=0
if len(Co)>1:
    St=len(Co)
    if len(Co)%2==1:
        St-=1
Nw=0
if Co[St-1]==1:
    Nw+=1
    St-=2
while St>1:
    Nw+=Co[St-1]
    Nw1=Nw-1
    Nw1*=Nw
    Nw1//=2
    Sc+=Nw*Co[St-2]
    St-=2
print (Sc)
0