結果

問題 No.44 DPなすごろく
ユーザー vjudge1
提出日時 2025-11-20 20:59:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 336 bytes
コンパイル時間 616 ms
コンパイル使用メモリ 68,264 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-11-20 20:59:15
合計ジャッジ時間 1,798 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
using namespace std;
long long count=0;

void resolve(int n){
    long long state_1=1;
    long long state_2=1;
    for(int i=2;i<=n;i++){
        count=(state_1+state_2);
        state_1=state_2;
        state_2=count;
    }
}
int main(){
    int n;
    cin>>n;
    resolve(n);
    cout<<count<<endl;
    return 0;
}
0