当前位置:网站首页>剑指 Offer 14- I. 剪绳子
剑指 Offer 14- I. 剪绳子
2022-08-02 02:45:00 【henujolly】
class Solution {
public:
int cuttingRope(int n) {
vector <int> dp(n + 1);
for (int i = 2; i <= n; i++) {
int curMax = 0;
for (int j = 1; j < i; j++) {
curMax = max(curMax, max(j * (i - j), j * dp[i - j]));
}
dp[i] = curMax;
}
return dp[n];
}
};
边栏推荐
- aws s3上传文件
- mockjs生成假数据的基本使用
- [Server data recovery] Data recovery case of server Raid5 array mdisk disk offline
- 2022-07-30 mysql8 executes slow SQL-Q17 analysis
- 搭建zabbix监控及邮件报警(超详细教学)
- 2022 Henan Youth Training League Game (3)
- analog IC layout-Environmental noise
- AcWing 1285. 单词 题解(AC自动机)
- 【Unity入门计划】2D Game Kit:初步了解2D游戏组成
- Nacos源码分析专题(二)-服务注册
猜你喜欢
随机推荐
MySQL - CRUD operations
mysql 查看死锁
JVM调优实战
Unable to log in to the Westward Journey
罗德里格斯公式(Rodrigues‘ Rotation Formula)推导
mockjs生成假数据的基本使用
789. 数的范围
The failure to create a role in Dahua Westward Journey has been solved
第10章_索引优化与查询优化
[Unity entry plan] 2D Game Kit: A preliminary understanding of the composition of 2D games
(一)Redis: 基于 Key-Value 的存储系统
AI目标分割能力,无需绿幕即可实现快速视频抠图
Outsourcing worked for three years, it was abolished...
[Server data recovery] Data recovery case of server Raid5 array mdisk disk offline
Nanoprobes丨1-mercapto-(triethylene glycol) methyl ether functionalized gold nanoparticles
最大层内元素和
BI - SQL 丨 WHILE
通用客户端架构
【CNN记录】tensorflow slice和strided_slice
菜刀webshell特征分析









