結果

問題 No.346 チワワ数え上げ問題
ユーザー maruyuki95maruyuki95
提出日時 2018-01-08 03:46:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,620 KB
実行使用メモリ 9,012 KB
最終ジャッジ日時 2023-08-24 23:51:44
合計ジャッジ時間 1,753 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,840 KB
testcase_01 AC 15 ms
7,852 KB
testcase_02 AC 16 ms
7,792 KB
testcase_03 AC 15 ms
7,792 KB
testcase_04 AC 15 ms
7,876 KB
testcase_05 AC 15 ms
7,904 KB
testcase_06 AC 15 ms
7,796 KB
testcase_07 AC 15 ms
7,804 KB
testcase_08 AC 15 ms
7,836 KB
testcase_09 AC 15 ms
7,948 KB
testcase_10 AC 23 ms
8,888 KB
testcase_11 AC 20 ms
8,548 KB
testcase_12 AC 22 ms
8,636 KB
testcase_13 AC 19 ms
8,428 KB
testcase_14 AC 16 ms
7,848 KB
testcase_15 AC 21 ms
8,596 KB
testcase_16 AC 22 ms
8,660 KB
testcase_17 AC 24 ms
9,012 KB
testcase_18 AC 24 ms
8,836 KB
testcase_19 AC 23 ms
8,688 KB
testcase_20 AC 28 ms
8,956 KB
testcase_21 AC 30 ms
8,896 KB
testcase_22 AC 31 ms
8,848 KB
testcase_23 AC 16 ms
7,836 KB
testcase_24 AC 15 ms
7,908 KB
testcase_25 AC 15 ms
7,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def execute(arg):
    ans = 0
    wCount = 0

    rev = list(arg)
    rev.reverse()

    for idx, s in enumerate(rev):
        if(s == "w"):
            wCount += 1

        if(s == "c"):
            ans += wCount * (wCount - 1) // 2

    return ans

print(execute(input()))
0