結果

問題 No.44 DPなすごろく
ユーザー A_ru8743731
提出日時 2017-07-09 15:05:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 561 bytes
コンパイル時間 586 ms
コンパイル使用メモリ 80,768 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-07 04:28:44
合計ジャッジ時間 1,481 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>
#include <cstdlib>
#include <string.h>
#include <cmath>
#include <cstdio>
#include <map>
#include <queue>
#include <utility>

using namespace std;

const int INF = 1000000007;
const double PI = acos(-1.0);
typedef long long ll;

int main()
{
	int N;
	cin >> N;
	ll dp[51];
	dp[0] = 0;
	dp[1] = 1;
	dp[2] = 2;

	for (int i = 3; i <= N; i++)
		dp[i] = dp[i - 1] + dp[i - 2];

	cout << dp[N] << endl;
	
}



0