結果

問題 No.346 チワワ数え上げ問題
ユーザー rocoderrocoder
提出日時 2017-07-07 03:10:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 743 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 12,388 KB
最終ジャッジ日時 2024-04-15 22:19:44
合計ジャッジ時間 2,367 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,624 KB
testcase_01 AC 31 ms
10,496 KB
testcase_02 AC 31 ms
10,496 KB
testcase_03 AC 30 ms
10,624 KB
testcase_04 AC 31 ms
10,496 KB
testcase_05 AC 30 ms
10,496 KB
testcase_06 AC 31 ms
10,496 KB
testcase_07 AC 31 ms
10,624 KB
testcase_08 AC 32 ms
10,496 KB
testcase_09 AC 31 ms
10,496 KB
testcase_10 AC 72 ms
11,392 KB
testcase_11 AC 56 ms
11,264 KB
testcase_12 AC 61 ms
11,520 KB
testcase_13 AC 51 ms
11,136 KB
testcase_14 AC 33 ms
10,496 KB
testcase_15 AC 59 ms
11,264 KB
testcase_16 AC 63 ms
11,264 KB
testcase_17 AC 69 ms
11,648 KB
testcase_18 AC 70 ms
11,648 KB
testcase_19 AC 64 ms
11,392 KB
testcase_20 AC 79 ms
11,520 KB
testcase_21 AC 156 ms
12,388 KB
testcase_22 AC 152 ms
12,160 KB
testcase_23 AC 31 ms
10,624 KB
testcase_24 AC 31 ms
10,624 KB
testcase_25 AC 31 ms
10,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=list(input())
i=0
Co=[]
while i<len(S)-1:
 #   print (S)
    if S[i]=="c":
   #     print (i)
        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