結果
問題 | No.346 チワワ数え上げ問題 |
ユーザー |
![]() |
提出日時 | 2016-02-27 22:43:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 631 bytes |
コンパイル時間 | 556 ms |
コンパイル使用メモリ | 58,212 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 11:51:43 |
合計ジャッジ時間 | 1,697 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <iostream> #include <vector> /* * [No.346 チワワ数え上げ問題 - yukicoder](http://yukicoder.me/problems/987 "No.346 チワワ数え上げ問題 - yukicoder") * 提出者 : まろ<marony@binbo-kodakusan.com> * 使用言語 C++ */ using namespace std; auto main() -> int { string s; cin >> s; auto count = 0L, answer = 0L; for (auto it = s.rbegin(); it != s.rend(); ++it) { const auto &c = (*it); if (c == 'c' && count > 1) { answer += count * (count - 1L) / 2L; } else if (c == 'w') ++count; } cout << answer << endl; return 0; }