結果
| 問題 | No.786 京都大学の過去問 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-08-31 08:31:23 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 582 bytes | 
| コンパイル時間 | 880 ms | 
| コンパイル使用メモリ | 94,632 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-25 00:23:20 | 
| 合計ジャッジ時間 | 1,263 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 5 | 
ソースコード
#include <iostream>
#include <utility>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
using namespace std;
using ll = long long int;
#define chmax(x,y)  x = (x > (y)) ? x : (x = (y));
#define chmin(x,y)  x = (x < (y)) ? x : (x = (y));
int main(int argc, char const *argv[])
{
  int N; cin >> N;
  vector<ll> dp(N+1);
  dp[0] = 1;
  for(int i=0;i<N;++i)
  {
    if(i+1 <= N)dp[i+1] += dp[i];
    if(i+2 <= N)dp[i+2] += dp[i];
  }
  std::cout << dp[N] << std::endl;
}
            
            
            
        