結果

問題 No.346 チワワ数え上げ問題
ユーザー yakeshibayakeshiba
提出日時 2021-03-13 04:57:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 191 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 65,536 KB
最終ジャッジ日時 2024-04-22 18:10:57
合計ジャッジ時間 2,761 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,224 KB
testcase_01 AC 38 ms
51,584 KB
testcase_02 AC 38 ms
51,712 KB
testcase_03 AC 37 ms
51,840 KB
testcase_04 AC 38 ms
51,840 KB
testcase_05 AC 37 ms
51,840 KB
testcase_06 AC 38 ms
51,968 KB
testcase_07 AC 37 ms
51,840 KB
testcase_08 AC 44 ms
52,180 KB
testcase_09 AC 48 ms
51,840 KB
testcase_10 AC 46 ms
65,280 KB
testcase_11 AC 44 ms
62,848 KB
testcase_12 AC 47 ms
64,128 KB
testcase_13 AC 45 ms
62,592 KB
testcase_14 AC 40 ms
58,112 KB
testcase_15 AC 45 ms
63,616 KB
testcase_16 AC 46 ms
64,256 KB
testcase_17 AC 47 ms
65,280 KB
testcase_18 AC 46 ms
65,536 KB
testcase_19 AC 45 ms
64,768 KB
testcase_20 AC 44 ms
58,496 KB
testcase_21 AC 45 ms
65,152 KB
testcase_22 AC 45 ms
64,896 KB
testcase_23 AC 39 ms
51,968 KB
testcase_24 AC 37 ms
51,712 KB
testcase_25 AC 39 ms
51,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()

#print(S)

c = 0
w = 0
ans = 0
for s in S[::-1]:
    if s == "c":
        c += 1
        ans += w*(w-1)//2
        #print(ans)
    if s == "w":
        w += 1
        
print(ans)
0