結果

問題 No.786 京都大学の過去問
ユーザー 11111Ark11111Ark
提出日時 2019-05-27 23:06:39
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 532 bytes
コンパイル時間 2,077 ms
コンパイル使用メモリ 200,968 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 18:20:02
合計ジャッジ時間 2,479 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int MOD=1000000007;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;


int main(){
	int n;
	cin>>n;
	ll dp[100];
	dp[0]=0,dp[1]=1,dp[2]=2;
	rep(i,3,n+1)dp[i]=dp[i-1]+dp[i-2];
	print(dp[n]);
}
0