Submission #71544
ソースコード
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 | #include <bits/stdc++.h> #define all(v) v.begin(), v.end() #define ll long long #define ptn(v) next_permutation(v.begin(), v.end()) #define fixed(v) fixed << setprecision(v) #define total(n) (n * (n + 1) / 2) #define lcm(a, b) ((a) * (b) / __gcd(a, b)) // binery_search(all(v),key) = keyがあるかないかをboolで返す // lower_bound(all(v),key) = key以上のイテレーターを返す(一番左) // upper_bound(all(v),key) = keyより大きい要素のイテレーターを返す // 最小値=max_element(v.begin(),v.end()); // 最大値=min_element(v.begin(),v.end()); using namespace std; int main(){ int p,n; cin>>p>>n; vector<vector<ll>> dp(n+1,vector<ll>(100000,0)); dp[0][0]=1; for ( int i=1;i<n;i++){ for ( int j=0;j<n;j++){ if (j==0){ dp[i][j]=dp[i-1][j+1]; } else { dp[i][j]=(dp[i-1][j-1]+dp[i-1][j+1])%100005; } } } cout<<dp[n-1][p]<<endl; return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0410 - メロディ作り |
ユーザー名 | ei2134 |
投稿日時 | 2022-07-27 13:15:29 |
言語 | C++17 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 1018 Byte |
最大実行時間 | 51 ms |
最大メモリ使用量 | 64012 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
test01.txt | AC | 41 ms | 19420 KB |
1
|
test02.txt | AC | 23 ms | 2756 KB |
1
|
test03.txt | AC | 28 ms | 9848 KB |
1
|
test04.txt | AC | 45 ms | 46744 KB |
1
|
test05.txt | AC | 46 ms | 53064 KB |
1
|
test06.txt | AC | 36 ms | 36592 KB |
1
|
test07.txt | AC | 26 ms | 19956 KB |
1
|
test08.txt | AC | 33 ms | 27080 KB |
1
|
test09.txt | AC | 51 ms | 64012 KB |
1
|
test10.txt | AC | 49 ms | 47456 KB |
1
|