結果
問題 |
No.346 チワワ数え上げ問題
|
ユーザー |
|
提出日時 | 2016-02-27 21:24:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 314 bytes |
コンパイル時間 | 662 ms |
コンパイル使用メモリ | 58,392 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-24 11:48:40 |
合計ジャッジ時間 | 1,566 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 9 |
ソースコード
#include <iostream> #include <vector> using std::vector; int main() { std::string s; int c = 0, w = 0; std::cin >> s; for (int i = s.length(); i >= 0; i--) if (s[i] == 'c') c += w * (w - 1) / 2; // wC2 else if (s[i] == 'w') w += 1; std::cout << c << std::endl; return 0; }