結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-08 10:43:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 75 ms / 2,000 ms |
| コード長 | 248 bytes |
| コンパイル時間 | 188 ms |
| コンパイル使用メモリ | 82,556 KB |
| 実行使用メモリ | 89,744 KB |
| 最終ジャッジ日時 | 2024-10-09 19:47:39 |
| 合計ジャッジ時間 | 2,377 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
l=list(input())
cnt=[[0]*2 for i in range(len(l)+1)]
for i in range(len(l)):
a=l[i]
cnt[i+1][0]=1 if a=="c" else 0
cnt[i+1][1]=cnt[i][1]+(1 if a=="w" else 0)
ans=0
for i,j in cnt:
ans+=i*(cnt[-1][1]-j)*(cnt[-1][1]-j-1)//2
print(ans)