結果
| 問題 | 
                            No.786 京都大学の過去問
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-08-31 08:30:49 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 583 bytes | 
| コンパイル時間 | 933 ms | 
| コンパイル使用メモリ | 94,280 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-25 00:22:31 | 
| 合計ジャッジ時間 | 1,349 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 WA * 2 | 
ソースコード
#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<int> 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;
}