当前位置:网站首页>Sword finger offer 14- I. cut rope
Sword finger offer 14- I. cut rope
2022-07-04 01:59:00 【South wind knows easy***】
class Solution {
public int cuttingRope(int n) {
//dp[i] The length is i Rope generation for m The maximum product of segments is ?i For state
int dp[]=new int[n+2];
dp[2]=1;
for(int i=3;i<=n;i++){
//1<=j<i
for(int j=1;j<i;j++){
// After cutting this paragraph , You can choose to continue cutting , You can also choose not to cut
dp[i]=Math.max(Math.max(j*dp[i-j],j*(i-j)),dp[i]);
}
}
return dp[n];
}
}
边栏推荐
- Portable two-way radio equipment - current market situation and future development trend
- Yyds dry goods inventory hand-in-hand teach you the development of Tiktok series video batch Downloader
- Special copy UML notes
- [typora installation package] old typera installation package, free version
- The reasons why QT fails to connect to the database and common solutions
- Openbionics robot project introduction | bciduino community finishing
- Gnupg website
- TP5 automatic registration hook mechanism hook extension, with a complete case
- Customize redistemplate tool class
- In yolov5, denselayer is used to replace focus, and the FPN structure is changed to bi FPN
猜你喜欢

Audio resource settings for U3D resource management

MySQL introduction - functions (various function statistics, exercises, details, tables)

Yyds dry goods inventory override and virtual of classes in C

C import Xls data method summary II (save the uploaded file to the DataTable instance object)

What are the advantages and disadvantages of data center agents?

Applet graduation project is based on wechat classroom laboratory reservation applet graduation project opening report function reference

Make drop-down menu

Yyds dry goods inventory hand-in-hand teach you the development of Tiktok series video batch Downloader

Small program graduation project based on wechat examination small program graduation project opening report function reference

IPv6 experiment
随机推荐
Introduction to graphics: graphic painting (I)
Huawei cloud micro certification Huawei cloud computing service practice has been stable
Intel's new GPU patent shows that its graphics card products will use MCM Packaging Technology
Flex flexible layout, box in the middle of the page
Luogu p1309 Swiss wheel
Properties of binary trees (numerical aspects)
Customize redistemplate tool class
Description of setting items of Jerry [chapter]
How to view the computing power of GPU?
After listening to the system clear message notification, Jerry informed the device side to delete the message [article]
Related configuration commands of Huawei rip
Three layer switching ①
Make drop-down menu
A. ABC
Why can't it run (unresolved)
Sequence sorting of basic exercises of test questions
MPLS③
Audio resource settings for U3D resource management
Portable two-way radio equipment - current market situation and future development trend
Jerry's modification setting status [chapter]