結果

問題 No.786 京都大学の過去問
コンテスト
ユーザー Bucchiman
提出日時 2020-05-21 22:22:22
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 433 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 151 ms
コンパイル使用メモリ 38,880 KB
最終ジャッジ日時 2026-02-22 05:43:54
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

/*
 * FileName:     no_786_fix
 * CreatedDate:  2020-05-21 22:04:08 +0900
 * LastModified: 2020-05-21 22:22:13 +0900
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void){
    int n;
    scanf("%d",&n);
    long int *dp = malloc(sizeof(long int)*(n+1));
    dp[0]=1;
    dp[1]=1;
    for(int i=2;i<n+1;i++){
        dp[i] = dp[i-1] + dp[i-2];
    }
    printf("%lld\n",dp[n]);
    free(dp);
    return 0;
}
0