当前位置:网站首页>DP energy Necklace
DP energy Necklace
2022-04-23 14:13:00 【Stingy old Sao】
Energy necklace
#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
#define int long long
typedef long long LL;
typedef long long ll;
const int INF = 0x3f3f3f3f;
//const int inf = 1e18;
const int mod = 998244353;
//const int mod = 1e9 + 7;
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
const int maxn = 1e4 + 10;
const int N = 6e6 + 100;
int dp[maxn][maxn];
int a[maxn];
int v[maxn];
void solve() {
int n;
cin>>n;
for (int i = 1; i <=n; ++i) {
cin>>a[i];
a[n+i]=a[i];
}
for(int len=3;len<=n+1;len++){
for(int l=1;l<=2*n-len+1;l++){
int r=l+len-1;
for(int k=l+1;k<r;k++){
dp[l][r]=max(dp[l][r],dp[l][k]+dp[k][r]+a[l]*a[k]*a[r]);
}
}
}
int res=0;
for(int i=1;i<=n;i++){
res=max(res,dp[i][i+n]);
}
cout<<res;
}
signed main() {
//ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int _ = 1;
// cin >> _;
while (_--) {
solve();//cout<<"\n";
}
return 0;
}
//12341
//14321
//
版权声明
本文为[Stingy old Sao]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231407093980.html
边栏推荐
- 帆软中单元格中隔行变色以及数量大于100字体变大变红设置
- Postman的安装使用及填坑心得
- Win10 comes with groove music, which can't play cue and ape files. It's a curvilinear way to save the country. It creates its own aimpack plug-in package, and aimp installs DSP plug-in
- ThreadGroup ThreadGroup implémente l'interface threadfactory en utilisant la classe Introduction + Custom thread Factory
- jsp学习3
- 困扰多年的系统调研问题有自动化采集工具了,还是开源免费的
- RobotFramework 之 用例执行
- 01-NIO基础之ByteBuffer和FileChannel
- On the problem of cliff growth of loss function in the process of training
- 帆软之单元格部分字体变颜色
猜你喜欢
帆软中根据分类进行汇总
倒计时1天~2022云容灾产品线上发布会即将开始
Wechat applet initializes Bluetooth, searches nearby Bluetooth devices and connects designated Bluetooth (I)
MYSQL 主从同步避坑版教程
政务云迁移实践 北明数科使用HyperMotion云迁移产品为某政府单位实施上云迁移项目,15天内完成近百套主机迁移
多云数据流转?云上容灾?年前最后的价值内容分享
Chrome插件 之 Selenium IDE、XPath 安装
MySQL数据库讲解(八)
什么是云迁移?云迁移的四种模式分别是?
在MAC上安装mysql
随机推荐
MySQL数据库讲解(十)
Redis数据库讲解(一)
openstack理论知识
Wechat applet positioning and ranging through low-power Bluetooth device (2)
教育行业云迁移最佳实践:海云捷迅使用HyperMotion云迁移产品为北京某大学实施渐进式迁移,成功率100%
Some experience of using dialogfragment and anti stepping pit experience (getactivity and getdialog are empty, cancelable is invalid, etc.)
某政务云项目业务系统迁移调研实践
关于Jmeter启动闪退问题
redis数据库讲解(三)redis数据类型
Jmeter设置环境变量支持在任意终端目录输入jmeter直接启动
Some good articles on pthread multithreading
mysql 5.1升级到5.66
星界边境文本自动翻译机使用说明
线程间控制之CountDownLatch和CyclicBarrier使用介绍
Jira截取全图
dp-[NOIP2000]方格取数
Wechat applet communicates with low-power Bluetooth - sending data to hardware (III)
HyperMotion云迁移完成阿里云专有云产品生态集成认证
ThreadGroup ThreadGroup implémente l'interface threadfactory en utilisant la classe Introduction + Custom thread Factory
使用DialogFragment的一些感受及防踩坑经验(getActivity、getDialog为空,cancelable无效等)