結果

問題 No.44 DPなすごろく
ユーザー nullpo_head
提出日時 2016-10-01 16:04:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 290 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 53,648 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 12:48:38
合計ジャッジ時間 1,517 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%llu", &N);
      |     ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <iostream>

using namespace std;

typedef unsigned long long ull;

ull N;
ull dp[51];

int main() {
    scanf("%llu", &N);

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

    printf("%llu\n", dp[N]);
}
0