当前位置:网站首页>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 project based on wechat video broadcast small program graduation project opening report function reference
- Cancer biopsy instruments and kits - market status and future development trends
- Mobile phone battery - current market situation and future development trend
- Maximum entropy model
- Iclr2022 | ontoprotein: protein pre training integrated with gene ontology knowledge
- Portapack application development tutorial (XVII) nRF24L01 launch C
- LV1 previous life archives
- Question C: Huffman tree
- C import Xls data method summary I (upload files and create Workbooks)
- Applet graduation project based on wechat selection voting applet graduation project opening report function reference
猜你喜欢
Valentine's Day - 9 jigsaw puzzles with deep love in wechat circle of friends
Hbuilder link Xiaoyao simulator
2020-12-02 SSM advanced integration Shang Silicon Valley
Infiltration learning diary day19
MySQL introduction - functions (various function statistics, exercises, details, tables)
Will the memory of ParticleSystem be affected by maxparticles
When tidb meets Flink: tidb efficiently enters the lake "new play" | tilaker team interview
Magical usage of edge browser (highly recommended by program ape and student party)
Life cycle of instance variables, static variables and local variables
[leetcode daily question] a single element in an ordered array
随机推荐
Méthode de calcul de la connexion MSSQL de la carte esp32c3
Development of user-defined navigation bar in uniapp
What is the student party's Bluetooth headset recommendation? Student party easy to use Bluetooth headset recommended
G3 boiler water treatment registration examination and G3 boiler water treatment theory examination in 2022
2022 R2 mobile pressure vessel filling certificate examination and R2 mobile pressure vessel filling simulation examination questions
Jerry's watch listens to the message notification of the target third-party software and pushes the message to the device [article]
Infiltration learning diary day19
Small program graduation project based on wechat reservation small program graduation project opening report reference
The latest analysis of hoisting machinery command in 2022 and free examination questions of hoisting machinery command
Maximum entropy model
Human resource management online assignment
Special copy UML notes
Intel's new GPU patent shows that its graphics card products will use MCM Packaging Technology
Customize redistemplate tool class
Why is the operation unsuccessful (unresolved) uncaught syntaxerror: invalid or unexpected token (resolved)
Will the memory of ParticleSystem be affected by maxparticles
Use classname to modify style properties
String: LV1 eat hot pot
Make drop-down menu
C import Xls data method summary IV (upload file de duplication and database data De duplication)