結果
問題 |
No.44 DPなすごろく
|
ユーザー |
![]() |
提出日時 | 2015-10-29 15:44:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,038 bytes |
コンパイル時間 | 1,247 ms |
コンパイル使用メモリ | 159,408 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 04:33:43 |
合計ジャッジ時間 | 2,026 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> P; typedef pair<ll, ll> Pll; typedef vector<int> Vi; typedef tuple<int, int, int> T; #define FOR(i,s,x) for(int i=s;i<(int)(x);i++) #define REP(i,x) FOR(i,0,x) #define ALL(c) c.begin(), c.end() #define DUMP( x ) cerr << #x << " = " << ( x ) << endl ll dp[51] = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049, 12586269025, 20365011074}; int main() { // use scanf in CodeForces! cin.tie(0); ios_base::sync_with_stdio(false); int N; cin >> N; /* dp[0] = 1; REP(i, N) { if (i == 0) { dp[i+1] = dp[i]; } else { dp[i+1] = dp[i] + dp[i-1]; } }*/ cout << dp[N] << endl; return 0; }