結果
| 問題 | No.44 DPなすごろく |
| ユーザー |
shossiissohs
|
| 提出日時 | 2018-01-10 18:32:13 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 5,000 ms |
| + 320µs | |
| コード長 | 417 bytes |
| 記録 | |
| コンパイル時間 | 793 ms |
| コンパイル使用メモリ | 180,568 KB |
| 実行使用メモリ | 9,872 KB |
| 最終ジャッジ日時 | 2026-10-06 15:15:17 |
| 合計ジャッジ時間 | 2,836 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[105][105];
int main() {
int n;
cin >> n;
dp[0][0] = 1;
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
if(j + 1 <= n) {
dp[i+1][j+1] += dp[i][j];
}
if(j + 2 <= n) {
dp[i+1][j+2] += dp[i][j];
}
}
}
ll ans = 0;
for(int i = 0; i <= n; i++) ans += dp[i][n];
cout << ans << endl;
}
shossiissohs