結果
問題 |
No.44 DPなすごろく
|
ユーザー |
|
提出日時 | 2020-09-19 22:24:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 625 bytes |
コンパイル時間 | 1,590 ms |
コンパイル使用メモリ | 168,996 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-23 20:09:52 |
合計ジャッジ時間 | 2,478 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 1 WA * 19 |
ソースコード
#include <bits/stdc++.h> #include <iostream> #include<math.h> using namespace std; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } int main() { int64_t N; cin >> N; vector<int>vec{1, 2}; vector<int64_t>dp(N+1, 0); dp[0] = 1; for (int64_t i=0; i<N; i++) { for (int j=0; i<=1; j++) { int64_t num = i + vec[j]; if (num > N) break; dp[num] += dp[i]; } } cout << dp[N] << endl; return 0; }