結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
|
提出日時 | 2016-03-08 22:03:39 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 526 bytes |
コンパイル時間 | 312 ms |
コンパイル使用メモリ | 82,592 KB |
実行使用メモリ | 186,716 KB |
最終ジャッジ日時 | 2024-09-24 15:33:19 |
合計ジャッジ時間 | 6,188 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 21 TLE * 1 -- * 1 |
ソースコード
from functools import reduce from operator import mul # nC2 def combi(n): return (n * (n-1)) // 2 def solve(): s = input() cl, wl = [], [] slen = len(s) for i in range(slen): if s[i] == "c": cl.append(i) continue elif s[i] == "w": wl.append(i) res = 0 for cidx in cl: wlen = len([0 for i in wl if i > cidx]) if wlen < 2: break res += combi(wlen) print(res) if __name__=="__main__": solve()