Submission #71490
ソースコード
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 ll long long #define all(x) x.begin(),x.end() #define fol(i,s,g) for(int i=(int)(s); i<(int)(g); i++) #define fix(ans,k) fixed << setprecision(k) << (double)ans #define total(n) n*(n+1)/2 #define lcm(a,b) (a/__gcd(a,b)*b) #define mod 100005 int main(){ int p, n; cin >> p >> n; vector<vector<ll>> dp(n, vector<ll>(n+10,0)); dp[0][0] = 1; fol(i,1,n){ fol(j,0,n){ 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]) % mod; } } cout << dp[n-1][p] << '\n' ; return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0410 - メロディ作り |
ユーザー名 | ei2109 |
投稿日時 | 2022-07-27 09:45:43 |
言語 | C++17 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 705 Byte |
最大実行時間 | 40 ms |
最大メモリ使用量 | 692 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
test01.txt | AC | 40 ms | 604 KB |
1
|
test02.txt | AC | 23 ms | 692 KB |
1
|
test03.txt | AC | 16 ms | 540 KB |
1
|
test04.txt | AC | 24 ms | 512 KB |
1
|
test05.txt | AC | 29 ms | 580 KB |
1
|
test06.txt | AC | 35 ms | 512 KB |
1
|
test07.txt | AC | 22 ms | 588 KB |
1
|
test08.txt | AC | 28 ms | 552 KB |
1
|
test09.txt | AC | 19 ms | 644 KB |
1
|
test10.txt | AC | 26 ms | 560 KB |
1
|