結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-11 11:55:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 397 bytes |
| コンパイル時間 | 406 ms |
| コンパイル使用メモリ | 56,048 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 08:07:11 |
| 合計ジャッジ時間 | 1,285 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <iostream>
#include <cstdint>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string s;
cin >> s;
uint64_t ans = 0;
uint64_t w = 0;
for (int i = s.size() - 1; 0 <= i; i--) {
if (s.at(i) == 'w') {
w++;
continue;
}
if (s.at(i) == 'c') {
ans += w * (w - 1) / 2;
}
}
cout << ans << endl;
}