結果

問題 No.346 チワワ数え上げ問題
ユーザー irumo8202irumo8202
提出日時 2022-01-23 18:16:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 171 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 82,948 KB
最終ジャッジ日時 2023-08-19 23:49:58
合計ジャッジ時間 3,581 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,400 KB
testcase_01 AC 74 ms
71,440 KB
testcase_02 AC 73 ms
71,472 KB
testcase_03 AC 72 ms
71,400 KB
testcase_04 AC 77 ms
71,284 KB
testcase_05 AC 73 ms
71,360 KB
testcase_06 AC 73 ms
71,240 KB
testcase_07 AC 72 ms
71,532 KB
testcase_08 AC 73 ms
71,020 KB
testcase_09 AC 71 ms
71,332 KB
testcase_10 AC 85 ms
76,192 KB
testcase_11 AC 80 ms
75,984 KB
testcase_12 AC 80 ms
75,920 KB
testcase_13 AC 82 ms
75,936 KB
testcase_14 AC 74 ms
75,104 KB
testcase_15 AC 80 ms
75,776 KB
testcase_16 AC 83 ms
75,940 KB
testcase_17 AC 80 ms
76,172 KB
testcase_18 AC 82 ms
75,796 KB
testcase_19 AC 80 ms
75,956 KB
testcase_20 AC 86 ms
82,848 KB
testcase_21 AC 90 ms
82,948 KB
testcase_22 AC 90 ms
82,872 KB
testcase_23 AC 72 ms
71,256 KB
testcase_24 AC 70 ms
71,124 KB
testcase_25 AC 72 ms
71,540 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