結果
問題 |
No.44 DPなすごろく
|
ユーザー |
![]() |
提出日時 | 2017-12-18 00:56:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 746 bytes |
コンパイル時間 | 1,947 ms |
コンパイル使用メモリ | 168,068 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-15 23:28:41 |
合計ジャッジ時間 | 3,015 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> #define REP(i,n) for (int i=0;i<(n);i++) #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define dump1d_arr(array,i) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl; #define dump2d_arr(array,i,j) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl; #define dump(x) cerr << #x << " => " << (x) << endl; #define CLR(vec) { REP(i,vec.size()) vec[i] = 0; } #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) using namespace std; typedef long long LL; typedef vector<LL> VLL; int main(void){ short N; cin >> N; VLL dp(N+1,0); dp[0] = 1; dp[1] = 1; FOR(i,2,N+1){ dp[i] = dp[i-1] + dp[i-2]; } cout << dp[N] << endl; return 0; }