結果
| 問題 |
No.44 DPなすごろく
|
| ユーザー |
|
| 提出日時 | 2017-12-06 02:17:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,234 bytes |
| コンパイル時間 | 854 ms |
| コンパイル使用メモリ | 92,232 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-28 19:26:31 |
| 合計ジャッジ時間 | 1,798 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
using namespace std;
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PP(p) cout<<(p)<<" ";
#define pb push_back
#define mp make_pair
#define INF 1e18
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef pair<int, int> pi;
//int dy[8]={1,1,1,0,-1,-1,-1,0};
//int dx[8]={-1,0,1,1,1,0,-1,-1};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int mod=1e9+7;
int N,M;
vi a,b;
vi dp;
void input(){
cin>>N;
dp.resize(N+1,-1);
}
int dfs(int now){
if(now==N)return 1;
if(now>N)return 0;
if(dp[now]!=-1)return dp[now];
int ret=0;
ret+=dfs(now+1);
ret+=dfs(now+2);
return dp[now]=ret;
}
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
input();
P(dfs(0))
return 0;
}