結果

問題 No.346 チワワ数え上げ問題
ユーザー rocoderrocoder
提出日時 2017-07-07 02:52:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 736 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-04-15 22:11:07
合計ジャッジ時間 2,210 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 AC 29 ms
10,624 KB
testcase_03 AC 30 ms
10,624 KB
testcase_04 AC 30 ms
10,624 KB
testcase_05 RE -
testcase_06 AC 30 ms
10,624 KB
testcase_07 AC 29 ms
10,624 KB
testcase_08 AC 29 ms
10,624 KB
testcase_09 AC 30 ms
10,624 KB
testcase_10 AC 66 ms
11,648 KB
testcase_11 AC 52 ms
11,264 KB
testcase_12 AC 61 ms
11,520 KB
testcase_13 AC 49 ms
11,136 KB
testcase_14 AC 31 ms
10,624 KB
testcase_15 AC 56 ms
11,392 KB
testcase_16 AC 60 ms
11,520 KB
testcase_17 AC 66 ms
11,648 KB
testcase_18 AC 68 ms
11,648 KB
testcase_19 AC 61 ms
11,520 KB
testcase_20 AC 76 ms
11,776 KB
testcase_21 AC 152 ms
12,288 KB
testcase_22 AC 156 ms
12,288 KB
testcase_23 AC 36 ms
10,752 KB
testcase_24 AC 31 ms
10,624 KB
testcase_25 AC 30 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

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
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