結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
|
提出日時 | 2020-07-19 23:00:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 331 bytes |
コンパイル時間 | 1,382 ms |
コンパイル使用メモリ | 167,904 KB |
実行使用メモリ | 13,636 KB |
最終ジャッジ日時 | 2024-12-17 17:08:45 |
合計ジャッジ時間 | 9,383 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 TLE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) typedef long long ll; int main(){ string s; cin>>s; int n=s.size(); ll ans=0; for(ll i=0; i<n; i++){ ll cnt=0; if(s[i]=='c'){ for(ll j=i; j<n; j++){ if(s[j]=='w') cnt++; } } ans+=(cnt*(cnt-1))/2; } cout<<ans<<endl; }