結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-14 01:32:20 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 430 bytes |
| コンパイル時間 | 691 ms |
| コンパイル使用メモリ | 66,816 KB |
| 最終ジャッジ日時 | 2025-01-09 18:20:37 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <iostream>
#include <string>
using lint = long long;
void solve() {
std::string s;
std::cin >> s;
lint x = 0, y = 0, ans = 0;
for (char c : s) {
if (c == 'c') ++x;
if (c == 'w') {
ans += y;
y += x;
}
}
std::cout << ans << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}