結果

問題 No.44 DPなすごろく
ユーザー Krishna Sameer
提出日時 2022-10-04 19:30:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 485 bytes
コンパイル時間 1,803 ms
コンパイル使用メモリ 165,384 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 07:40:47
合計ジャッジ時間 2,814 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define int long long
#define pb emplace_back
#define sz(v) (int)(v.size())
#define all(v) (v.begin(),v.end())

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	int n;
	cin >> n;
	int dp[n+1];
	dp[0] = 0;
	dp[1] = 1;
	dp[2] = 2;
	for(int i = 3;i<n+1;i++){
		dp[i] = dp[i-1] + dp[i-2];
	}
	cout << dp[n];
	return 0;
}
0