当前位置:网站首页>[dynamic planning] interval dp:p3205 Chorus
[dynamic planning] interval dp:p3205 Chorus
2022-07-02 00:57:00 【muse_ age】



Code :
Be careful
1. Fill in the form from small range to large range :
2. Take the mold after each addition
#include<iostream>
using namespace std;
int n;
int a[1001];
int dp[1001][1001][2];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
dp[i][i][0]=1;
}
for(int len=2;len<=n;len++){
for(int i=1;i+len-1<=n;i++){
int j=i+len-1;
dp[i][j][0]=(dp[i+1][j][0]*(a[i]<a[i+1])+dp[i+1][j][1]*(a[i]<a[j]))%19650827;
dp[i][j][1]=(dp[i][j-1][1]*(a[j]>a[j-1])+dp[i][j-1][0]*(a[j]>a[i]))%19650827;
}
}
cout<<(dp[1][n][1]+dp[1][n][0])%19650827;
}
边栏推荐
- export default 导出的对象,不能解构问题,和module.exports的区别
- JMeter做接口测试,如何提取登录Cookie
- Use es to realize epidemic map or take out order function (including code and data)
- Global and Chinese markets of beverage seasoning systems 2022-2028: Research Report on technology, participants, trends, market size and share
- Friends circle community program source code sharing
- 股票开户哪个证券公司比较安全
- 【八大排序③】快速排序(动图演绎Hoare法、挖坑法、前后指针法)
- Global and Chinese markets for freight and logistics 2022-2028: Research Report on technology, participants, trends, market size and share
- Node -- egg implements the interface of uploading files
- Global and Chinese market of avionics systems 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢

Excel search and reference function

Leetcode skimming: stack and queue 04 (delete all adjacent duplicates in the string)

excel查找与引用函数
![[opencv450] hog+svm and hog+cascade for pedestrian detection](/img/55/cdf0bb8231ee59e34c8d5a9d6def23.png)
[opencv450] hog+svm and hog+cascade for pedestrian detection

Upgraded wechat tool applet source code for mobile phone detection - supports a variety of main traffic modes

Slf4j print abnormal stack information

【八大排序②】选择排序(选择排序,堆排序)

Viewing and modifying volume group attributes of Aix storage management (II)

Kuberntes cloud native combat high availability deployment architecture

New version of free mobile phone, PC, tablet, notebook four terminal Website thumbnail display diagram online one click to generate website source code
随机推荐
Global and Chinese market of ancillary software 2022-2028: Research Report on technology, participants, trends, market size and share
New version of free mobile phone, PC, tablet, notebook four terminal Website thumbnail display diagram online one click to generate website source code
Creation of volume group for AIX storage management (I)
Excel search and reference function
JMeter做接口测试,如何提取登录Cookie
【CTF】bjdctf_ 2020_ babystack2
Output results of convolution operation with multiple tensors and multiple convolution kernels
Global and Chinese market of collaborative applications 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets of edge AI software 2022-2028: Research Report on technology, participants, trends, market size and share
Schrodinger's Japanese learning applet source code
Node -- egg implements the interface of uploading files
Global and Chinese markets for distributed generation and energy storage in telecommunications networks 2022-2028: Research Report on technology, participants, trends, market size and share
Leetcode skimming: stack and queue 02 (realizing stack with queue)
【js通过url下载文件】
Upgraded wechat tool applet source code for mobile phone detection - supports a variety of main traffic modes
[cascade classifier training parameters] training Haar cascades
How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
Use es to realize epidemic map or take out order function (including code and data)
Which securities company is safer to open a stock account
S32Kxxx bootloader之UDS bootloader