結果
| 問題 |
No.44 DPなすごろく
|
| ユーザー |
めうめう🎒
|
| 提出日時 | 2016-03-27 20:57:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 644 bytes |
| コンパイル時間 | 659 ms |
| コンパイル使用メモリ | 72,312 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-02 05:08:21 |
| 合計ジャッジ時間 | 1,663 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)
int n;
ll memo[100];
ll saiki(int now){
if(now > n) return 0;
if(memo[now] != INFLL) return memo[now];
if(now == n) return 1;
ll sum = 0;
for(int i = 1;i <= 2;i++){
sum += saiki(now + i);
}
return memo[now] = sum;
}
int main() {
for(int i = 0;i < 100;i++){
memo[i] = INFLL;
}
cin >> n;
ll ans = saiki(0);
cout << ans << endl;
return 0;
}
めうめう🎒