結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
alpha_virginis
|
| 提出日時 | 2016-02-26 22:38:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 563 bytes |
| コンパイル時間 | 672 ms |
| コンパイル使用メモリ | 67,636 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 22:02:46 |
| 合計ジャッジ時間 | 1,575 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
long dp[112345][4];
int main() {
std::string str;
std::cin >> str;
dp[0][0] = 1;
for(int i = 0; i < (int)str.size(); ++i) {
for(int j = 0; j < 4; ++j) {
dp[i + 1][j] = dp[i][j];
}
if( str[i] == 'c' ) {
dp[i + 1][1] += dp[i][0];
}
if( str[i] == 'w' ) {
dp[i + 1][2] += dp[i][1];
dp[i + 1][3] += dp[i][2];
}
}
std::cout << dp[str.size()][3] << std::endl;
return 0;
}
alpha_virginis