Submission #03931
ソースコード
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 | #include<bits/stdc++.h> using namespace std; #define ANSWER(x) cout<<x<<endl #define debug(x) cout<<#x<<": "<<x const int BA = 1000; const int INFTY = (1<<21); int dp[101][101]; int p,n; int solve( int a, int b){ if (a < 0) return 0; if (dp[a][b] != -1) return dp[a][b]; else if (b == n){ if (a == p) return 1; else return 0; } else return dp[a][b] = (solve(a+1,b+1)+solve(a-1,b+1))%100005; } int main(){ memset (dp,-1, sizeof (dp)); cin >> p >> n; cout << solve(0,1) << endl; } |
ステータス
項目 | データ |
---|---|
問題 | 0410 - メロディ作り |
ユーザー名 | ei1506 |
投稿日時 | 2016-05-14 16:35:59 |
言語 | C++11 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 539 Byte |
最大実行時間 | 20 ms |
最大メモリ使用量 | 672 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
test01.txt | AC | 11 ms | 476 KB |
1
|
test02.txt | AC | 14 ms | 412 KB |
1
|
test03.txt | AC | 11 ms | 476 KB |
1
|
test04.txt | AC | 20 ms | 544 KB |
1
|
test05.txt | AC | 11 ms | 608 KB |
1
|
test06.txt | AC | 13 ms | 672 KB |
1
|
test07.txt | AC | 10 ms | 608 KB |
1
|
test08.txt | AC | 12 ms | 548 KB |
1
|
test09.txt | AC | 10 ms | 488 KB |
1
|
test10.txt | AC | 10 ms | 424 KB |
1
|