結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
willowoooo
|
| 提出日時 | 2016-05-15 22:07:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 325 bytes |
| コンパイル時間 | 567 ms |
| コンパイル使用メモリ | 60,024 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-06 04:08:59 |
| 合計ジャッジ時間 | 1,312 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
string s;
cin >> s;
long long ans = 0;
long long w = 0;
for (long long i = s.size()-1; i >= 0; i--)
{
if (s[i] == 'w')
w++;
if (s[i] == 'c')
ans += w*(w - 1) / 2;
}
cout << ans << endl;
return 0;
}
willowoooo