結果
問題 | No.346 チワワ数え上げ問題 |
ユーザー |
|
提出日時 | 2020-07-19 23:08:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 331 bytes |
コンパイル時間 | 1,715 ms |
コンパイル使用メモリ | 166,612 KB |
実行使用メモリ | 13,632 KB |
最終ジャッジ日時 | 2024-12-17 17:23:36 |
合計ジャッジ時間 | 10,010 ms |
ジャッジサーバーID (参考情報) |
judge1 / 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=n; j>i; j--){ if(s[j]=='w') cnt++; } } ans+=(cnt*(cnt-1))/2; } cout<<ans<<endl; }