Submission #29695
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include<bits/stdc++.h> using namespace std; int p,n; int dp[101][101]; // 高さ 数 int dfs( int i, int j){ int ret=0; if (dp[i][j]!=-1) return dp[i][j]; if (j==n-1){ if (i==p) ret+=1; } else if (j>n-1) return 0; else if (i>0) ret= dfs(i+1,j+1)+dfs(i-1,j+1); else ret= dfs(i+1,j+1); return dp[i][j]=ret%100005; } int main(){ memset (dp,-1, sizeof (dp)); cin>>p>>n; cout<<dfs(0,0)<<endl; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0410 - メロディ作り |
ユーザー名 | ei1725 |
投稿日時 | 2017-12-14 17:40:25 |
言語 | C++11 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 494 Byte |
最大実行時間 | 26 ms |
最大メモリ使用量 | 728 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
test01.txt | AC | 22 ms | 476 KB |
1
|
test02.txt | AC | 17 ms | 540 KB |
1
|
test03.txt | AC | 16 ms | 480 KB |
1
|
test04.txt | AC | 17 ms | 540 KB |
1
|
test05.txt | AC | 25 ms | 608 KB |
1
|
test06.txt | AC | 15 ms | 668 KB |
1
|
test07.txt | AC | 20 ms | 728 KB |
1
|
test08.txt | AC | 26 ms | 668 KB |
1
|
test09.txt | AC | 17 ms | 604 KB |
1
|
test10.txt | AC | 20 ms | 540 KB |
1
|