当前位置:网站首页>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];
}
}
边栏推荐
- Small program graduation design is based on wechat order takeout small program graduation design opening report function reference
- TP5 automatic registration hook mechanism hook extension, with a complete case
- Meta metauniverse female safety problems occur frequently. How to solve the related problems in the metauniverse?
- Basic editing specifications and variables of shell script
- SRCNN:Learning a Deep Convolutional Network for Image Super-Resolution
- C import Xls data method summary II (save the uploaded file to the DataTable instance object)
- Day05 branch and loop (II)
- Writeup (real questions and analysis of ciscn over the years) of the preliminary competition of national college students' information security competition
- Hunan University | robust Multi-Agent Reinforcement Learning in noisy environment
- Applet graduation project is based on wechat classroom laboratory reservation applet graduation project opening report function reference
猜你喜欢

1189. Maximum number of "balloons"

Feign implements dynamic URL

ES6 deletes an attribute in all array objects through map, deconstruction and extension operators

Small program graduation project based on wechat reservation small program graduation project opening report reference

Three layer switching ②

Infiltration learning diary day19

The reasons why QT fails to connect to the database and common solutions

Lightweight Pyramid Networks for Image Deraining

Use classname to modify style properties

Feign implements dynamic URL
随机推荐
Notice on Soliciting Opinions on the draft of information security technology mobile Internet application (APP) life cycle security management guide
Development of user-defined navigation bar in uniapp
On Valentine's day, I code a programmer's exclusive Bing Dwen Dwen (including the source code for free)
Gnupg website
C import Xls data method summary IV (upload file de duplication and database data De duplication)
Portapack application development tutorial (XVII) nRF24L01 launch C
Containerization technology stack
A. Min Max Swap
Conditional statements of shell programming
Make drop-down menu
The latest analysis of hoisting machinery command in 2022 and free examination questions of hoisting machinery command
How to subcontract uniapp and applet, detailed steps (illustration) # yyds dry goods inventory #
Jerry's modification setting status [chapter]
MySQL utilise la vue pour signaler les erreurs, Explicit / show ne peut pas être publié; Verrouillage des fichiers privés pour la table sous - jacente
Maximum entropy model
Push technology practice | master these two tuning skills to speed up tidb performance a thousand times!
Yyds dry goods inventory override and virtual of classes in C
What are the advantages and disadvantages of data center agents?
Chain ide -- the infrastructure of the metauniverse
Software product download collection