結果
| 問題 | No.786 京都大学の過去問 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-03-27 16:44:48 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 967 bytes | 
| コンパイル時間 | 1,719 ms | 
| コンパイル使用メモリ | 160,452 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2025-01-02 08:41:59 | 
| 合計ジャッジ時間 | 1,812 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 5 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド:(典型)dp,dfs,bfs,最短経路,その他
ll dp[55];
int main(){
    int n;cin >> n;
    for(int i=0;i<55;i++) dp[i]=0;
    dp[0]=1;
    rep(i,n){
        dp[i+2]+=dp[i];
        dp[i+1]+=dp[i];
    }
    cout << dp[n] << endl;
    return 0;
}
            
            
            
        