結果
| 問題 | No.44 DPなすごろく |
| ユーザー |
|
| 提出日時 | 2021-08-31 08:52:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 574 bytes |
| コンパイル時間 | 1,102 ms |
| コンパイル使用メモリ | 95,716 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 01:04:39 |
| 合計ジャッジ時間 | 1,494 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 20 |
コンパイルメッセージ
main.cpp: In function 'int main(int, const char**)':
main.cpp:21:18: warning: 'N' is used uninitialized [-Wuninitialized]
21 | vector<ll> dp(N+1,0);
| ~^~
main.cpp:20:7: note: 'N' was declared here
20 | int N;
| ^
ソースコード
#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;
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;
}