結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-08 22:06:25 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 487 bytes |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 82,092 KB |
| 実行使用メモリ | 257,816 KB |
| 最終ジャッジ日時 | 2024-09-24 15:38:48 |
| 合計ジャッジ時間 | 5,336 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 21 TLE * 1 -- * 1 |
ソースコード
# 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:
wl = [i for i in wl if i > cidx]
wlen = len(wl)
if wlen < 2:
break
res += combi(wlen)
print(res)
if __name__=="__main__":
solve()