結果

問題 No.346 チワワ数え上げ問題
ユーザー nohakai3nohakai3
提出日時 2022-10-31 15:12:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 148 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 86,692 KB
実行使用メモリ 76,132 KB
最終ジャッジ日時 2023-09-22 12:27:07
合計ジャッジ時間 3,849 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,332 KB
testcase_01 AC 76 ms
71,352 KB
testcase_02 AC 76 ms
71,268 KB
testcase_03 AC 76 ms
71,260 KB
testcase_04 AC 76 ms
71,304 KB
testcase_05 AC 77 ms
71,000 KB
testcase_06 AC 76 ms
71,204 KB
testcase_07 AC 76 ms
71,148 KB
testcase_08 AC 76 ms
71,152 KB
testcase_09 AC 75 ms
71,560 KB
testcase_10 AC 82 ms
75,764 KB
testcase_11 AC 81 ms
75,744 KB
testcase_12 AC 83 ms
76,132 KB
testcase_13 AC 82 ms
75,916 KB
testcase_14 AC 80 ms
75,684 KB
testcase_15 AC 82 ms
75,516 KB
testcase_16 AC 82 ms
75,764 KB
testcase_17 AC 82 ms
75,828 KB
testcase_18 AC 83 ms
75,860 KB
testcase_19 AC 83 ms
75,848 KB
testcase_20 AC 81 ms
75,880 KB
testcase_21 AC 82 ms
75,748 KB
testcase_22 AC 82 ms
75,960 KB
testcase_23 AC 76 ms
71,456 KB
testcase_24 AC 77 ms
71,280 KB
testcase_25 AC 76 ms
71,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s=input()
n=len(s)
cnt=0
ans=0
for i in range(n-1,-1,-1):
    if s[i]=="w":
        cnt+=1
    if s[i]=="c":
        ans+=cnt*(cnt-1)//2

print(ans)
0