結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
|
提出日時 | 2020-07-30 19:11:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 369 bytes |
コンパイル時間 | 2,022 ms |
コンパイル使用メモリ | 194,668 KB |
最終ジャッジ日時 | 2025-01-12 08:10:58 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 2 |
ソースコード
#include<bits/stdc++.h> #define mod 1000000007 using namespace std; int main(){ cin.tie(0),ios::sync_with_stdio(false); string s; cin>>s; int n=s.size(); vector<int>cnt(n+1,0); for(int i=n-1;i>=0;--i)cnt.at(i)=cnt.at(i+1)+(s.at(i)=='w'); int64_t ans=0; for(int i=0;i<n;++i){ if(s.at(i)!='c')continue; ans+=cnt.at(i)*(cnt.at(i)-1)/2; } cout<<ans<<"\n"s; }