結果
問題 | No.44 DPなすごろく |
ユーザー |
![]() |
提出日時 | 2024-02-20 02:27:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 392 bytes |
コンパイル時間 | 628 ms |
コンパイル使用メモリ | 63,372 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-09-29 03:22:09 |
合計ジャッジ時間 | 1,302 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <iostream>using namespace std;long long fibonacci(int n) {if (n <= 1)return n;long long prev = 0, current = 1;for (int i = 2; i <= n; ++i) {long long next = prev + current;prev = current;current = next;}return current;}int main() {int n;cin >> n;cout << fibonacci(n + 1) << endl;return 0;}