Program design and algorithm II Guo Wei's dynamic programming algorithm 017 cake and its problem-solving ideas

subject There is a large rectangular cake, the length and width are integers w and h respectively. Now to cut it into m small cakes, each small cake must be rectangular and have an integer length and width. When cutting a cake, cut one cake at a time and divide it into two rectangular cakes. Please calculate the lower limit of the area of the ...

Posted by jennyp on Fri, 10 Dec 2021 01:56:43 +0100

DP + complete knapsack problem: PIPI's piggy bank

DP + complete knapsack problem: PIPI's piggy bank Complete knapsack problem   we talked about the 01 knapsack problem earlier: DP + 01 backpack question: meal card . Now let's look at the complete knapsack problem. The only difference between the complete knapsack problem and the 01 knapsack problem is that each item in the 01 knaps ...

Posted by phphead on Tue, 07 Dec 2021 23:42:39 +0100

Java, Android Backpack Problem - Dynamic Planning

Preface Following the previous backpack problem, Greedy Algorithms, this time let's look at dynamic planning For dynamic planning, it is dynamic planning that comes into direct contact when you first look at the backpack problem Feeling is also simpler Specific requirements of the topic, see the previous one in detail, this one tells us ...

Posted by lhaynes on Mon, 06 Dec 2021 07:04:06 +0100

Special research on tree dp

Well, first of all, the key framework of tree dp. void dfs(int u,int fa){ ///Do something for(int i=0;i<a[u].size();++i){ //Do something int v=a[u][i]; if(v==fa) continue; //Do something } return; } This framework is really useful. The main relationship of tree dp is to deal with the relations ...

Posted by the_Igel on Fri, 03 Dec 2021 19:58:35 +0100

2021 12.2 simulation summary

As the first simulation competition after the beginning of high school, its significance is naturally unique. There are three questions, which are all simple in person. (but time is too short. Can you give more examples by way of Tucao? Make complaints about hand disability.) T1: given a polynomial (ax + by)k, request the coefficients of x ...

Posted by Josh954r on Thu, 02 Dec 2021 23:01:30 +0100

[LeetCode learning plan] dynamic planning on the 12th day of algorithm introduction C + +

LeetCode [learning plan]: [algorithm] preface Dynamic programming (DP) is a big head in the algorithm. It aims to turn the problem to be solved into several subproblems. First solve the subproblems, and then get the solution of the original problem from the solutions of these subproblems. Sub problems in dynamic programming are often ...

Posted by tonbah on Wed, 01 Dec 2021 11:07:09 +0100

Easy Minesweeper Game

I believe that everyone has played a minesweeper game. After learning the two-dimensional array, I also wrote a simple Minesweeper game rule in c language as follows: 1. Set the game's board size by using macro Row and macro List (Row and List are 12 If you want to play 10x10 minesweeper); 2. Set the number of mines in the board by macro Boom ...

Posted by veroaero on Wed, 01 Dec 2021 06:59:05 +0100

Dynamic programming algorithm machine side

A - high number Umaru series (9) - Husky Description Because the meow star people raised by Gao Shuju are too arrogant, they have to eat fresh cat food every day and often bully Gao Shuju, so Gao Shuju decides to buy some huskies to taste fresh. On this day, Gao Shuju came to the second-hand dog market to buy husky. Gao Shuju read all husky, w ...

Posted by adunphy on Wed, 01 Dec 2021 00:04:27 +0100

Dynamic programming matrix multiplication problem

Original link: https://www.cnblogs.com/fsmly/p/10228767.html description Matrix chain multiplication by dynamic programming Matrix chain multiplication problem   ) (1) problem description Given the chain of N matrices < a 1, a 2,..., a n >, where i=1,2,..., N, the dimension of matrix A i is p i-1 × p i. find a complete & ...

Posted by Gurzi on Tue, 30 Nov 2021 12:26:54 +0100

Minimum value problem of piggy bank (java)

1. Subjective questions   (100 points) Experiment 6: use dynamic programming algorithm to solve the problem of saving money (complete the contents of experiment report 3, 4, 5 and 6) 1, Experimental purpose         Practice using dynamic programming algorithms to solve practical problems (implemented in the ...

Posted by smileyriley21 on Sun, 28 Nov 2021 19:08:19 +0100