結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2018-03-13 23:54:27 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 339 bytes |
| コンパイル時間 | 426 ms |
| コンパイル使用メモリ | 55,004 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 09:59:04 |
| 合計ジャッジ時間 | 1,900 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 2 |
ソースコード
#include<iostream>
#include<string>
using namespace std;
int main(){
string S;
int wcount = 0;
long long ans = 0;
cin >> S;
for(int i=S.length()-1;i>=0;i--){
if(S[i] == 'w') wcount++;
else if(S[i] == 'c'){
ans += wcount*(wcount-1)/2;
}
}
cout << ans << endl;
return 0;
}
eve__fuyuki