結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
Kmcode1
|
| 提出日時 | 2016-02-26 22:25:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 1,081 bytes |
| コンパイル時間 | 895 ms |
| コンパイル使用メモリ | 91,760 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-09-22 14:05:03 |
| 合計ジャッジ時間 | 1,831 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:68:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
68 | scanf("%s", buf);
| ~~~~~^~~~~~~~~~~
ソースコード
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
using namespace std;
string s;
string f = "cww";
#define MAX 100002
bool use[MAX][4];
long long int dp[MAX][4];
char buf[MAX];
int n;
inline long long int dfs(int a, int b){
if (use[a][b]){
return dp[a][b];
}
if (b == 3){
return 1;
}
if (a == n){
return 0;
}
use[a][b] = true;
if (f[b] == s[a]){
dp[a][b] = dfs(a + 1, b + 1);
}
dp[a][b] += dfs(a + 1, b);
return dp[a][b];
}
int main(){
scanf("%s", buf);
s = buf;
n = s.size();
long long int ans = dfs(0, 0);
printf("%lld\n", ans);
return 0;
}
Kmcode1