結果

問題 No.786 京都大学の過去問
ユーザー MagrealaMagreala
提出日時 2019-11-12 04:25:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 964 bytes
コンパイル時間 1,241 ms
コンパイル使用メモリ 85,528 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-14 13:12:33
合計ジャッジ時間 1,695 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:34: warning: "rep" redefined
 #define rep(i,a,b) for(int i=int(a);i<int(b);++i)
 
main.cpp:33: note: this is the location of the previous definition
 #define rep(i,n) REP(i,0,n)
 
main.cpp:40:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main(){
      ^

ソースコード

diff #

#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)

using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    ll dp[N+1] = {1,1,2};
    rep(i,2,N+1){
        dp[i] = dp[i-1] + dp[i-2];
    }
    cout << dp[N] << endl;
}
0