Submission #03935
ソースコード
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 | #include<bits/stdc++.h> using namespace std; int p,n; int memo[101][101]; int makemelody( int scale, int cnt); int main() { cin >> p >> n; memset (memo,-1, sizeof (memo)); cout << makemelody(0,1) << endl; } int makemelody( int scale, int cnt){ int ans = 0; if (scale < 0) return 0 ; else if (memo[scale][cnt] != -1) return memo[scale][cnt]; else if (n == cnt && scale == p) return 1; else if (n == cnt) return 0; ans += ( makemelody( scale - 1, cnt + 1) + makemelody( scale + 1, cnt + 1) ); return memo[scale][cnt] = ans % 100005; } |
ステータス
項目 | データ |
---|---|
問題 | 0410 - メロディ作り |
ユーザー名 | ei1507 |
投稿日時 | 2016-05-14 16:40:34 |
言語 | C++11 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 583 Byte |
最大実行時間 | 13 ms |
最大メモリ使用量 | 808 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
test01.txt | AC | 13 ms | 476 KB |
1
|
test02.txt | AC | 11 ms | 672 KB |
1
|
test03.txt | AC | 12 ms | 736 KB |
1
|
test04.txt | AC | 12 ms | 544 KB |
1
|
test05.txt | AC | 11 ms | 608 KB |
1
|
test06.txt | AC | 11 ms | 672 KB |
1
|
test07.txt | AC | 10 ms | 612 KB |
1
|
test08.txt | AC | 11 ms | 808 KB |
1
|
test09.txt | AC | 11 ms | 616 KB |
1
|
test10.txt | AC | 13 ms | 680 KB |
1
|