結果
| 問題 | 
                            No.44 DPなすごろく
                             | 
                    
| ユーザー | 
                             picakun
                         | 
                    
| 提出日時 | 2017-05-28 20:32:44 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 376 bytes | 
| コンパイル時間 | 615 ms | 
| コンパイル使用メモリ | 63,192 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-09-21 15:13:46 | 
| 合計ジャッジ時間 | 12,352 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 TLE * 1 | 
| other | AC * 20 | 
ソースコード
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector<long> memo(51,-1);
long dp(int N){
	if(memo[N] == -1){
		if(N <= 2){
			memo[N] = N;
			return N;
		}
		else{
			return dp(N-1) + dp(N-2);
		}
	}
	else
		return memo[N];
}
int main(){
	int N;
	cin >> N;
	long long ans;
	ans = dp(N);
	cout << ans << endl;
	return 0;
}
            
            
            
        
            
picakun