結果
| 問題 | No.44 DPなすごろく |
| ユーザー |
tanutarou730
|
| 提出日時 | 2017-07-23 03:16:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 706 bytes |
| 記録 | |
| コンパイル時間 | 1,262 ms |
| コンパイル使用メモリ | 158,400 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 10:18:29 |
| 合計ジャッジ時間 | 2,247 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;
ll dp[100][100];
int main(void) {
//ios_base::sync_with_stdio(false);
//cin.tie(0);
int n;
cin >> n;
dp[0][0] = 1;
for(int i=1; i<=n; i++){
for(int j=n; j>=0; j--){
dp[i][j] = 0;
if(j-1 >= 0){
dp[i][j] += dp[i-1][j-1];
}
if(j-2 >= 0){
dp[i][j] += dp[i-1][j-2];
}
}
}
/*
for(int j=0; j<=n; j++){
for(int i=0; i<=n; i++){
printf("%d ", dp[j][i]);
}
puts("");
}
*/
ll ans = 0;
for(int i=0; i<=n; i++){
ans += dp[i][n];
}
cout << ans << endl;
return 0;
}
tanutarou730