結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
![]() |
提出日時 | 2017-05-07 22:44:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 322 bytes |
コンパイル時間 | 1,566 ms |
コンパイル使用メモリ | 166,400 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 14:52:50 |
合計ジャッジ時間 | 2,655 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 2 |
ソースコード
#include <bits/stdc++.h> #define REP(i,n,N) for(int i=(n);i<(int)N;i++) #define p(s) cout<<(s)<<endl typedef long long ll; using namespace std; int main(){ string s; cin>>s; int w=0; ll ans=0; for(int i=s.size()-1;i>=0;i--){ if(s[i]=='w') w++; else if(s[i]=='c') { ans+=w*(w-1)/2; } } p(ans); return 0; }