結果
| 問題 | No.786 京都大学の過去問 |
| コンテスト | |
| ユーザー |
Magreala
|
| 提出日時 | 2019-11-12 04:25:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 964 bytes |
| 記録 | |
| コンパイル時間 | 708 ms |
| コンパイル使用メモリ | 85,172 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-16 07:57:58 |
| 合計ジャッジ時間 | 1,114 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 |
コンパイルメッセージ
main.cpp:34: warning: "rep" redefined
34 | #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
33 | #define rep(i,n) REP(i,0,n)
|
main.cpp:40:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
40 | main(){
| ^~~~
ソースコード
#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;
}
Magreala