結果
| 問題 | No.44 DPなすごろく |
| ユーザー |
|
| 提出日時 | 2021-08-31 08:55:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 584 bytes |
| コンパイル時間 | 871 ms |
| コンパイル使用メモリ | 94,124 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 01:09:23 |
| 合計ジャッジ時間 | 1,685 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <utility>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
using namespace std;
using ll = long long int;
#define chmax(x,y) x = (x > (y)) ? x : (x = (y));
#define chmin(x,y) x = (x < (y)) ? x : (x = (y));
int main(int argc, char const *argv[])
{
int N; cin >> N;
vector<ll> dp(N+1,0);
dp[0] = 1;
for(int i=0;i<N;++i)
{
if(i+1 <= N)dp[i+1] += dp[i];
if(i+2 <= N)dp[i+2] += dp[i];
}
std::cout << dp[N] << std::endl;
}