Submission #71771
ソースコード
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 main(){ int p,n; cin>>p>>n; long long dp[100][101]={}; long long mod=100005; dp[0][0]=1; for ( int i=0;i<n-1;i++){ for ( int j=0;j<=100;j++){ if (dp[i][j]>=1){ if (j==0){ dp[i+1][j+1]+=dp[i][j]; dp[i+1][j+1]%=mod; } else { dp[i+1][j+1]+=dp[i][j]; dp[i+1][j+1]%=mod; dp[i+1][j-1]+=dp[i][j]; dp[i+1][j-1]%=mod; } } } } cout<<dp[n-1][p]<< "\n" ; return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0410 - メロディ作り |
ユーザー名 | ei2122 |
投稿日時 | 2022-08-15 15:41:32 |
言語 | C++17 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 665 Byte |
最大実行時間 | 23 ms |
最大メモリ使用量 | 632 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
test01.txt | AC | 20 ms | 604 KB |
1
|
test02.txt | AC | 23 ms | 632 KB |
1
|
test03.txt | AC | 22 ms | 400 KB |
1
|
test04.txt | AC | 21 ms | 424 KB |
1
|
test05.txt | AC | 22 ms | 448 KB |
1
|
test06.txt | AC | 20 ms | 596 KB |
1
|
test07.txt | AC | 20 ms | 624 KB |
1
|
test08.txt | AC | 21 ms | 520 KB |
1
|
test09.txt | AC | 22 ms | 548 KB |
1
|
test10.txt | AC | 15 ms | 452 KB |
1
|