Game 36 of 2021 freshman individual training competition

Question A: gifts Title Description In an n × On the grid graph of N, there are m gifts. Each gift has a value vi(1 ≤ i ≤ m). You can choose a gift and then choose: (1) Take all the gifts listed with it, or (2) take all the gifts with it What is the sum of the maximum value of the gifts you can get? input The first line has two pos ...

Added by Sturm on Tue, 08 Feb 2022 13:29:50 +0200

Basic dynamic programming -- knapsack problem

The knapsack problem is divided into 01 knapsack problem and complete knapsack problem. The knapsack problem, in the words of a certain respondent, is: a thief carried a knapsack and sneaked into the gold store. The bag is so big. How can he ensure that all the items he carried are of the greatest value Principle of dynamic programming Simi ...

Added by Bricktop on Mon, 07 Feb 2022 08:05:58 +0200

Interval DP Luogu classic questions P1775 P1880 P2858 P1063

Algorithm design of dynamic programming 1: Find out the properties of the optimal solution and describe its structural characteristics 2: Define the optimal value recursively 3: Calculate the optimal value in a bottom-up manner 4: The optimal solution is constructed according to the information obtained when calculating the optimal value ...

Added by ChetUbetcha on Mon, 07 Feb 2022 04:15:15 +0200

LeetCode interview question 17.21 water volume of histogram

Title Link: LeetCode interview question 17.21 water volume of histogram Main idea of the title: Solution: dynamic programming For the subscript \ (I \), the maximum height that the water can reach is equal to the minimum value of the maximum height on both sides of the subscript \ (I \), so you can use dynamic programming to deduce the maximum ...

Added by tigger on Sun, 06 Feb 2022 08:33:25 +0200

Formula string problem and Joseph Ring problem

catalogue 1. Formula string problem  2. Joseph Ring problem 1. Formula string problem First, let's look at a prototype: Corresponding letecode link: Interview question 16.26 Calculator - LeetCode (LeetCode CN. Com) Title Description: Given an arithmetic expression (except parentheses) containing positive integers, p ...

Added by slibob on Sat, 05 Feb 2022 20:41:04 +0200

Blue Bridge Cup bun count

Number of buns Xiao Ming eats breakfast at a bun shop almost every morning. He found that the bun was paved with N kinds of steaming cages, of which the second type just fits Ai buns. Each type of steamer has many cages, which can be considered infinite. Whenever a customer wants to buy X buns, the uncle who sells buns quickly picks up severa ...

Added by hayunna on Sat, 05 Feb 2022 20:07:01 +0200

Solution of knapsack force complete knapsack programming (C + + 01)

The theoretical content is recorded in the code Capriccio. Here I mainly write my own explanation and review, which is highly recommended Code capriccio, code Capriccio PDF, code Capriccio Baidu online disk, code Capriccio knowledge planet, code Capriccio octet PDF, code Capriccio brush question route, code Capriccio knowledge planet octethttp ...

Added by NickTyson on Fri, 04 Feb 2022 10:24:52 +0200

Basic problems of dynamic programming

1, Basic dynamic programming Like greedy algorithm, in dynamic programming, the solution of a problem can be regarded as the result of a series of decisions. The difference is that in the greedy algorithm, an irrevocable decision is made every time the greedy criterion is used, while in dynamic programming, it is also necessary to investig ...

Added by banned in dc on Fri, 04 Feb 2022 06:10:44 +0200

[daily force deduction 37] looting

1, Title [LeetCode-198] You are a professional thief who plans to steal houses along the street. There is a certain amount of cash hidden in each room. The only restrictive factor affecting your theft is that the adjacent houses are equipped with interconnected anti-theft systems. If two adjacent houses are intruded by thieves on the same nigh ...

Added by ekosoftco on Thu, 03 Feb 2022 13:34:45 +0200

CF1630B Range and Partition

First, see minimize y − x y-x y − x this thing, decisive two points y − x y-x y &m ...

Added by rupam_jaiswal on Thu, 03 Feb 2022 12:54:12 +0200