結果

問題 No.44 DPなすごろく
ユーザー sugarrr
提出日時 2018-01-04 17:46:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 408 bytes
コンパイル時間 655 ms
コンパイル使用メモリ 66,720 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 03:43:47
合計ジャッジ時間 1,589 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #



#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
typedef long long ll;
using namespace std;



int main(){
    int n;cin>>n;
    long long int dp[n+1];
    dp[1]=1;dp[2]=2;
    for(int i=3;i<=n;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    cout<<dp[n]<<endl;
    return 0;
}
0