結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-27 17:21:19 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 727µs | |
| コード長 | 524 bytes |
| 記録 | |
| コンパイル時間 | 276 ms |
| コンパイル使用メモリ | 71,664 KB |
| 実行使用メモリ | 9,800 KB |
| 最終ジャッジ日時 | 2026-09-03 05:49:10 |
| 合計ジャッジ時間 | 1,678 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <string>
int
main()
{
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::string s;
std::cin >> s;
std::uint64_t cnt = 0, wcnt = 0;
for (std::string::size_type i = s.length() - 1; i != static_cast<std::string::size_type>(-1); i--) {
switch (s[i]) {
case 'c':
cnt += wcnt * (wcnt - 1) / 2;
break;
case 'w':
wcnt++;
break;
}
}
std::cout << cnt << std::endl;
return EXIT_SUCCESS;
}