Submission #68018
ソースコード
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 | #include<bits/stdc++.h> using namespace std; #define ll long long #define vi vector<int> #define all(v) v.begin(),v.end() #define fi first #define se second #define P pair<int,int> #define mp(a,b) make_pair(a,b) #define pb(a) push_back(a) int main(){ cin.tie(nullptr); ios_base::sync_with_stdio( false ); int p,n; cin>>p>>n; vector<vector< int >> dp(n+1,vector< int >(n+5,0)); //dp[i][j]:i個の音を使い、j音高いメロディーを構成 dp[1][0]=1; for ( int i=1;i<=n;i++){ dp[i][0]+=dp[i-1][1]; for ( int j=1;j<=n;j++){ dp[i][j]=dp[i-1][j-1]+dp[i-1][j+1]; dp[i][j]%=100005; } } cout<<dp[n][p]<< "\n" ; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0410 - メロディ作り |
ユーザー名 | ei2005 |
投稿日時 | 2021-08-06 11:05:01 |
言語 | C++17 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 739 Byte |
最大実行時間 | 44 ms |
最大メモリ使用量 | 720 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
test01.txt | AC | 44 ms | 472 KB |
1
|
test02.txt | AC | 22 ms | 556 KB |
1
|
test03.txt | AC | 20 ms | 512 KB |
1
|
test04.txt | AC | 21 ms | 720 KB |
1
|
test05.txt | AC | 33 ms | 652 KB |
1
|
test06.txt | AC | 18 ms | 588 KB |
1
|
test07.txt | AC | 17 ms | 532 KB |
1
|
test08.txt | AC | 24 ms | 480 KB |
1
|
test09.txt | AC | 21 ms | 556 KB |
1
|
test10.txt | AC | 28 ms | 612 KB |
1
|