結果

問題 No.44 DPなすごろく
ユーザー newlife171128
提出日時 2018-01-26 21:05:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 528 bytes
コンパイル時間 4,019 ms
コンパイル使用メモリ 156,728 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-28 00:00:27
合計ジャッジ時間 2,881 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <utility>

typedef long long ll;
using namespace std;

typedef pair<int, int> P;

long  dp[51];



int main() {

	dp[0]=0; dp[1] =1; dp[2] =2;

	int n=0;

	cin>>n;
	for(int i=3; i<=n; i++){
		dp[i] = dp[i-1]+dp[i-2];
	}

	cout<<dp[n]<<endl;



	return 0;
}
0