結果

問題 No.346 チワワ数え上げ問題
ユーザー irumo8202irumo8202
提出日時 2022-01-23 18:16:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 171 bytes
コンパイル時間 846 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 74,416 KB
最終ジャッジ日時 2024-05-07 07:05:40
合計ジャッジ時間 2,170 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,676 KB
testcase_01 AC 37 ms
52,944 KB
testcase_02 AC 36 ms
52,756 KB
testcase_03 AC 33 ms
51,940 KB
testcase_04 AC 35 ms
52,392 KB
testcase_05 AC 35 ms
52,548 KB
testcase_06 AC 35 ms
51,820 KB
testcase_07 AC 35 ms
51,880 KB
testcase_08 AC 36 ms
52,068 KB
testcase_09 AC 35 ms
52,940 KB
testcase_10 AC 43 ms
65,052 KB
testcase_11 AC 41 ms
62,472 KB
testcase_12 AC 43 ms
64,472 KB
testcase_13 AC 43 ms
63,168 KB
testcase_14 AC 37 ms
57,864 KB
testcase_15 AC 44 ms
62,800 KB
testcase_16 AC 45 ms
64,120 KB
testcase_17 AC 45 ms
65,184 KB
testcase_18 AC 47 ms
65,848 KB
testcase_19 AC 45 ms
64,532 KB
testcase_20 AC 48 ms
70,416 KB
testcase_21 AC 51 ms
74,416 KB
testcase_22 AC 51 ms
74,012 KB
testcase_23 AC 34 ms
52,304 KB
testcase_24 AC 34 ms
52,064 KB
testcase_25 AC 36 ms
52,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = [x for x in input() if x == "c" or x == "w"]


ans = 0
w = 0

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