当前位置:网站首页>dp-能量项链
dp-能量项链
2022-04-23 14:08:00 【抠脚老騷】
能量项链
#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
//
版权声明
本文为[抠脚老騷]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_45436102/article/details/123975536
边栏推荐
- Can I compile the header file and source file of the template separately
- 帆软中单元格中隔行变色以及数量大于100字体变大变红设置
- 报表FCRA考试题集及答案(错了11题)
- Detailed tutorial on the use of smoke sensor (mq-2) (based on raspberry pie 3B +)
- MySQL数据库讲解(八)
- 帆软报表设置单元格填报以及根据值的大小进行排名方法
- 某政务云项目业务系统迁移调研实践
- Oracle-数据泵使用
- 利用json-server在本地创建服务器请求
- mysql 5.1升级到5.66
猜你喜欢
RobotFramework 之 用例执行
快速安装mongodb
Mock测试
Idea控制台乱码解决
使用Postman进行Mock测试
Some experience of using dialogfragment and anti stepping pit experience (getactivity and getdialog are empty, cancelable is invalid, etc.)
Pycharm连接远程服务器并实现远程调试
帆软中需要设置合计值为0时,一整行都不显示的解决办法
Operation instructions of star boundary text automatic translator
HyperBDR云容灾V3.2.1版本发布|支持更多云平台,新增监控告警功能
随机推荐
mysql 5.1升级到5.610
服务器日志分析工具(识别,提取,合并,统计异常信息)
关于Jmeter启动闪退问题
帆软中根据分类进行汇总
Wechat applet initializes Bluetooth, searches nearby Bluetooth devices and connects designated Bluetooth (I)
封装logging模块
Understand the concepts of virtual base class, virtual function and pure virtual function (turn)
Storage path of mod subscribed by starbound Creative Workshop at Star boundary
MySQL数据库讲解(八)
RecyclerView进阶使用-实现仿支付宝菜单编辑页面拖拽功能
VMWare安装64位XP中文教程
redis数据库讲解二(redis高可用、持久化、性能管理)
星界边境文本自动翻译机(高级版)使用说明
1到100号的灯开关问题
关于云容灾,你需要知道这些
Jacob print word
VMware Workstation 无法连接到虚拟机。系统找不到指定的文件
Multiple inheritance virtual base exercises
Prediction of tomorrow's trading limit of Low Frequency Quantization
org.apache.parquet.schema.InvalidSchemaException: A group type can not be empty. Parquet does not su