結果
問題 |
No.44 DPなすごろく
|
ユーザー |
![]() |
提出日時 | 2014-11-12 18:47:18 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,220 bytes |
コンパイル時間 | 527 ms |
コンパイル使用メモリ | 68,328 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-31 10:01:41 |
合計ジャッジ時間 | 1,404 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<cstdio> #include<cstdlib> #include<cstring> #include<string> #include<map> #include<queue> using namespace std; template<typename T1, typename T2> istream& operator>>(istream& is, pair<T1,T2>& a){ return is >> a.first >> a.second; } template<typename T1, typename T2> ostream& operator<<(ostream& os, pair<T1,T2>& a){ return os << a.first << " " << a.second; } template<typename T> istream& operator>>(istream& is, vector< T >& vc){ for(int i = 0; i < vc.size(); i++) is >> vc[i]; return is; } template<typename T> ostream& operator<<(ostream& os, vector< T >& vc){ for(int i = 0; i < vc.size(); i++) os << vc[i] << endl; return os; } #define ForEach(it,c) for(__typeof (c).begin() it = (c).begin(); it != (c).end(); it++) #define ALL(v) (v).begin(), (v).end() #define UNQ(s) { sort(ALL(s)); (s).erase( unique( ALL(s)), (s).end());} typedef pair< double , double > Pi; typedef pair< double , Pi > Pii; typedef long long int64; int main(){ int N; cin >> N; vector< int64 > dp(N + 1, 0); dp[1] = 1, dp[2] = 2; for(int i = 3; i <= N; i++){ dp[i] = dp[i - 1] + dp[i - 2]; } cout << dp[N] << endl; }