結果
問題 |
No.44 DPなすごろく
|
ユーザー |
![]() |
提出日時 | 2021-01-25 20:03:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 286 bytes |
コンパイル時間 | 1,373 ms |
コンパイル使用メモリ | 165,612 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 15:05:14 |
合計ジャッジ時間 | 2,312 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; ll memo[55]; ll f(int n){ if(memo[n]) return memo[n]; memo[n] = 1; if(n < 2) return memo[n] = 1; else return memo[n] = f(n-1)+f(n-2); } int main(){ int n; cin >> n; cout << f(n) << endl; return 0; }