Submission #27814


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<iostream>
#include<cstring>
using namespace std;
int p,n;
int memo[101][101];
int dfs(int cnt,int now){
int rec=0;
if(now<0)return 0;
if(memo[cnt][now]!=-1)return memo[cnt][now];
if(cnt==n-1&&now==p)return 1;
if(cnt==n-1)return 0;
rec+=dfs(cnt+1,now+1);
rec+=dfs(cnt+1,now-1);
return memo[cnt][now]=rec%100005;
}
int main(){
memset(memo,-1,sizeof(memo));
cin>>p>>n;
cout<<dfs(0,0)<<endl;
return(0);
}

ステータス

項目 データ
問題 0410 - メロディ作り
ユーザー名 r1705
投稿日時 2017-10-24 18:52:17
言語 C++11
状態 Accepted
得点 10
ソースコード長 459 Byte
最大実行時間 27 ms
最大メモリ使用量 668 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
test01.txt AC 24 ms 480 KB
1
test02.txt AC 19 ms 412 KB
1
test03.txt AC 18 ms 480 KB
1
test04.txt AC 22 ms 416 KB
1
test05.txt AC 16 ms 480 KB
1
test06.txt AC 23 ms 540 KB
1
test07.txt AC 13 ms 600 KB
1
test08.txt AC 19 ms 668 KB
1
test09.txt AC 27 ms 604 KB
1
test10.txt AC 24 ms 536 KB
1