Submission #28794
ソースコード
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 | #include<bits/stdc++.h> using namespace std; int dp[205][200]; //y==musical scale x==number of time int p,n; //0==s int solve( int now, int time ){ if (now<0|| time <1) return 0; if (dp[now][ time ]!=-1) return dp[now][ time ]; return dp[now][ time ]=(solve(now-1, time -1)+solve(now+1, time -1))%100005; } int main(){ for ( int i=0;i<205;i++){ for ( int j=0;j<101;j++){ dp[i][j]=-1; if (i==0&&j==1) dp[i][j]=1; if (j==1&&i!=0) dp[i][j]=0; } } cin >> p >> n; cout << solve(p,n) << endl; } |
ステータス
項目 | データ |
---|---|
問題 | 0410 - メロディ作り |
ユーザー名 | ei1710 |
投稿日時 | 2017-11-18 12:48:55 |
言語 | C++11 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 545 Byte |
最大実行時間 | 25 ms |
最大メモリ使用量 | 720 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
test01.txt | AC | 21 ms | 604 KB |
1
|
test02.txt | AC | 22 ms | 672 KB |
1
|
test03.txt | AC | 14 ms | 612 KB |
1
|
test04.txt | AC | 13 ms | 688 KB |
1
|
test05.txt | AC | 19 ms | 632 KB |
1
|
test06.txt | AC | 25 ms | 704 KB |
1
|
test07.txt | AC | 22 ms | 644 KB |
1
|
test08.txt | AC | 16 ms | 720 KB |
1
|
test09.txt | AC | 17 ms | 668 KB |
1
|
test10.txt | AC | 18 ms | 616 KB |
1
|