結果

問題 No.346 チワワ数え上げ問題
ユーザー yumechi
提出日時 2016-03-08 22:23:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 63,772 KB
最終ジャッジ日時 2024-09-24 15:45:18
合計ジャッジ時間 1,916 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    s = input()[::-1]
    wc = 0
    
    res = 0
    for c in s:
        if c == "c":
            if wc >= 2:
                res += (wc * (wc-1)) // 2
            continue
        if c == "w":
            wc += 1
    print(res)
    

if __name__=="__main__":
    solve()
0