結果

問題 No.346 チワワ数え上げ問題
ユーザー Konton7Konton7
提出日時 2019-05-02 23:54:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 10,588 KB
実行使用メモリ 12,428 KB
最終ジャッジ日時 2023-08-30 04:59:56
合計ジャッジ時間 2,322 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,944 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 AC 17 ms
7,804 KB
testcase_03 AC 15 ms
7,760 KB
testcase_04 AC 16 ms
7,840 KB
testcase_05 AC 17 ms
7,860 KB
testcase_06 AC 16 ms
7,772 KB
testcase_07 AC 16 ms
7,792 KB
testcase_08 AC 16 ms
7,844 KB
testcase_09 AC 16 ms
7,856 KB
testcase_10 AC 54 ms
8,220 KB
testcase_11 AC 36 ms
8,312 KB
testcase_12 AC 43 ms
8,280 KB
testcase_13 AC 34 ms
8,136 KB
testcase_14 AC 17 ms
7,920 KB
testcase_15 AC 40 ms
8,332 KB
testcase_16 AC 44 ms
8,388 KB
testcase_17 AC 52 ms
8,208 KB
testcase_18 AC 50 ms
8,260 KB
testcase_19 AC 45 ms
8,240 KB
testcase_20 AC 48 ms
9,728 KB
testcase_21 AC 62 ms
12,428 KB
testcase_22 AC 64 ms
12,408 KB
testcase_23 AC 16 ms
7,864 KB
testcase_24 AC 16 ms
7,800 KB
testcase_25 AC 16 ms
7,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
ls = len(s)

c_list = []
w_counter = 0

for i in range(ls):
    if s[ls-i-1] == "c":
        c_list.append(w_counter)
    elif s[ls-i-1] == "w":
        w_counter += 1


sum_list = [0]
for i in range(w_counter+1):
    sum_list.append(sum_list[-1]+i)

c_list = [ sum_list[c_list[i]] for i in range(len(c_list))]
print(sum(c_list))
0