結果

問題 No.786 京都大学の過去問
コンテスト
ユーザー 11111Ark
提出日時 2019-05-27 23:06:39
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 532 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,138 ms
コンパイル使用メモリ 208,704 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-07 12:04:39
合計ジャッジ時間 1,941 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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