Submission #16249


ソースコード

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
29
30
31
32
33
34
35
36
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int p,n;
int dp[111][11111];
int mkml(int now,int ml);
int main(){
memset(dp,-1,sizeof(dp));
scanf(" %d %d",&p,&n);
printf("%d\n",mkml(1,0) % 100005);
return 0;
}
int mkml(int now,int ml){
//printf("%d %d\n",now,ml);
if(ml<0)return 0;
if(now == n){
if(ml == p)return 1;
else return 0;
}
if(dp[now][ml] != -1)return dp[now][ml];
return dp[now][ml] = (mkml(now+1,ml+1) + mkml(now+1,ml-1)) % 100005;
}

ステータス

項目 データ
問題 0410 - メロディ作り
ユーザー名 Xyca.
投稿日時 2017-05-01 18:00:32
言語 C++11
状態 Accepted
得点 10
ソースコード長 580 Byte
最大実行時間 21 ms
最大メモリ使用量 5504 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
test01.txt AC 19 ms 5216 KB
1
test02.txt AC 20 ms 5248 KB
1
test03.txt AC 18 ms 5408 KB
1
test04.txt AC 18 ms 5436 KB
1
test05.txt AC 17 ms 5344 KB
1
test06.txt AC 15 ms 5252 KB
1
test07.txt AC 17 ms 5284 KB
1
test08.txt AC 21 ms 5440 KB
1
test09.txt AC 17 ms 5344 KB
1
test10.txt AC 13 ms 5504 KB
1