結果
問題 |
No.44 DPなすごろく
|
ユーザー |
![]() |
提出日時 | 2018-01-10 15:50:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 411 bytes |
コンパイル時間 | 541 ms |
コンパイル使用メモリ | 77,060 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 15:37:43 |
合計ジャッジ時間 | 1,298 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <string> #include <numeric> #define rep(i,n) for(int i=0;i<(n);i++) using ll = long long int; using namespace std; int main() { int N; cin >> N; vector<ll> dp(N + 1); 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; return 0; }