結果

問題 No.44 DPなすごろく
ユーザー kaililits
提出日時 2018-06-01 18:37:33
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 235 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 483 ms
コンパイル使用メモリ 62,272 KB
最終ジャッジ日時 2026-03-20 04:47:35
合計ジャッジ時間 1,063 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:6:3: error: 'uint64_t' was not declared in this scope
    6 |   uint64_t dp[51];
      |   ^~~~~~~~
main.cpp:2:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    1 | #include <iostream>
  +++ |+#include <cstdint>
    2 | using namespace std;
main.cpp:7:3: error: 'dp' was not declared in this scope
    7 |   dp[0] = 1;
      |   ^~

ソースコード

diff #
raw source code

#include <iostream>
using namespace std;

int main() {
  int n;
  uint64_t dp[51];
  dp[0] = 1;
  dp[1] = 1;
  cin >> n;

  for (int i = 2; i <= n; i++) {
    dp[i] = dp[i - 1] + dp[i - 2];
  }

  cout << dp[n] << endl;

  return 0;
}
0