当前位置:网站首页>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];
}
}
边栏推荐
- Push technology practice | master these two tuning skills to speed up tidb performance a thousand times!
- Create template profile
- Containerization technology stack
- [typora installation package] old typera installation package, free version
- A. ABC
- Learn these super practical Google browser skills, girls casually flirt
- Méthode de calcul de la connexion MSSQL de la carte esp32c3
- A fan summed up so many interview questions for you. There is always one you need!
- mysql使用視圖報錯,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
- Hamburg University of Technology (tuhh) | intelligent problem solving as integrated hierarchical reinforcement learning
猜你喜欢

String & memory function (detailed explanation)

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

LeetCode226. Flip binary tree

Remember a lazy query error

IPv6 experiment

MPLS③

Conditional statements of shell programming

Three layer switching ②

Maximum entropy model

Three layer switching ①
随机推荐
Pytoch residual network RESNET
JVM performance tuning and practical basic theory - medium
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
2022 new examination questions for safety management personnel of hazardous chemical business units and certificate examination for safety management personnel of hazardous chemical business units
Learn these super practical Google browser skills, girls casually flirt
A fan summed up so many interview questions for you. There is always one you need!
Openbionics robot project introduction | bciduino community finishing
Meta metauniverse female safety problems occur frequently, how to solve the relevant problems in the metauniverse?
Jerry's watch listens to the message notification of the target third-party software and pushes the message to the device [article]
Is Shengang securities company as safe as other securities companies
From the 18th line to the first line, the new story of the network security industry
Solution to the problem that jsp language cannot be recognized in idea
Why is the operation unsuccessful (unresolved) uncaught syntaxerror: invalid or unexpected token (resolved)
mysql使用視圖報錯,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
Rearrangement of tag number of cadence OrCAD components and sequence number of schematic page
MySQL advanced SQL statement (1)
2022 R2 mobile pressure vessel filling certificate examination and R2 mobile pressure vessel filling simulation examination questions
How to subcontract uniapp and applet, detailed steps (illustration) # yyds dry goods inventory #
Winter vacation daily question -- a single element in an ordered array
C import Xls data method summary I (upload files and create Workbooks)