結果

問題 No.786 京都大学の過去問
ユーザー DA__1337DA__1337
提出日時 2019-08-01 00:48:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 650 bytes
コンパイル時間 1,727 ms
コンパイル使用メモリ 164,328 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-18 17:14:29
合計ジャッジ時間 2,034 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

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