結果

問題 No.44 DPなすごろく
ユーザー shop_one
提出日時 2020-04-15 14:45:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 904 ms
コンパイル使用メモリ 95,048 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-01 18:45:20
合計ジャッジ時間 1,977 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
signed main(){
  init_io();
  ll n;
  cin >> n;
  vector<ll> dp(n+1,0);
  dp[0] = 1;
  dp[1] = 1;
  for(int i=2;i<=n;i++){
    dp[i] = dp[i-1]+dp[i-2];
  }
  cout << dp[n]<<endl;
}
0