結果
| 問題 |
No.44 DPなすごろく
|
| ユーザー |
cww
|
| 提出日時 | 2017-09-18 15:13:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 640 bytes |
| コンパイル時間 | 1,995 ms |
| コンパイル使用メモリ | 193,828 KB |
| 最終ジャッジ日時 | 2025-01-05 02:58:53 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define SORT(x) sort((x).begin(),(x).end(),greater<int>())
using LL=long long;
using ULL=unsigned long long;
using PII=pair<int,int>;
const LL INF = numeric_limits<LL>::max();
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
int N;
cin >> N;
vector<LL> dp( 50 + 1 );
dp[ 0 ] = 1;
dp[ 1 ] = 1;
for( int i = 2; i <= N; i++ )
{
dp[ i ] = dp[ i - 1 ] + dp[ i - 2 ];
}
cout << dp[ N ] << endl;
return 0;
}
cww