01 backpack, 01 backpack Problems
Input
Each test point (input file) has only one set of test data.
The first act of each group of test data is two positive integers N and M, indicating the number of prizes and the number of prizes in the small Ho hands.
The next n rows describe each row to describe a prize. The I behavior contains two integers: need (I) and value (I). The meaning is described in the pr
/* Multiple backpacks, which are converted into 01 backpacks using the binary splitting method */# include
/* Completely converted from a backpack to a repeated 01 backpack */# include
/* The two-dimensional cost is much deformed. The triple cycle is hard to grasp. */# Include
Learn notes, please correct me if there is any mistake, thank you.1 Creating an image wireframe2 Create tab1 under Image (No wireframe selected)3 Create Image1 under TAB1 (checked wireframe)4 Add the component toggle under Image1 and specify TargetgraphicMainly by clicking to show5 copy 2 respectively named TAB2, TAB36 Select image to add toggle Group7 Select Tab1, TAB2, tab3 to specify the same object with the toggle group8 Creation of 3 Panel1, Panel2, Panel39 Select Tab1, add events, drag int
, output an integer indicating the number of solution modulo 1,000,000,007 (1e9 + 7).You can get more details in the sample and hint below.Sample Input4 2 23) 2 2Sample Output12HintThe first Test case:the only solution is (2, 2).The second Test case:the solution is (1, 2) and (2, 1).Test instructions: There are k positive integers, and n, least common multiple m, how many combinations.Analysis: Because this k number is the factor of M, and all the factors of M is the case of all possible least c
P01: 0-1 backpack ProblemsQuestionThere are n items and a backpack with a capacity of v. The cost of the I-th item is C [I], and the value is W [I]. Solving which items are loaded into a backpack can make the total cost of these items not exceed the capacity of the backpack, and the total value is the largest.
Basic Id
Solution report
Question Portal
Question:
The size of V and the number of items are N. Each item has value and capacity, and the maximum value that can be loaded into the package is obtained.
Ideas:
Basic 01 backpack.
DP [J] = max (DP [J], DP [J-C [I] + W [I])
#include
Bone Collector
Time Limit: 2000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)Total submission (s): 29249 accepted submission (s): 11967
Problem descriptionpolicyear
Solution report
Question Portal
Question:
Calculate the minimum value of the deposit tank.
Ideas:
Full backpack basis. The initial DP is the largest, and DP [0] = 0 indicates that the empty piggy bank has a value of 0;
The state transition equation is DP [J] = min (DP [J], DP [J-W [I] + C [I]).
#include
Piggy-bank
Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)Total submission (s): 11691 accepted submission (s): 589
Happy Xiao Ming (Nanyang oj49) (01 backpack), Nanyang oj4901 backpackHappy James time limit: 1000 MS | memory limit: 65535 KB difficulty: 4
Description
James was very happy today. The new house purchased at home had the key. There was a very spacious room dedicated to him in the new house. Even more pleased, his mother said to him yesterday: "You have the final say about the items you need to purchase and how to arrange in your room, as l
integers in the first row of each set of data n,m (0After the M line, each row has two data ai (integer), bi (real) represents the first school of the application fee and may be the probability of getting an offer.The last entry has two 0.
OutputEach set of data corresponds to one output, indicating that the speakless may receive at least one offer of the maximum probability. Expressed as a percentage, accurate to one of the decimal places.
Sample Input10 34 0.14 0.25 0.30 0
Sample Output44%
Hi
Just say give you several items, then do 01 backpack, no more than it gives the first state of small B is how much.
Just look at the code, it's too much water.
#include
These two days after 01 backpack study Complete Backpack This full backpack refers to the number of items unlimited, let oneself to install consider the state transfer F[i][j]=max (F[i-1][j]) has not selected the article I, F[i][j]=max (F[i][j-w[i]+v[i]); Select an item from the I key the obvious state is that it is transferred by comparing the optimal solution o
Backpack Nine Talk Board
Examples refer to "Information Science Orsay a pass"
Initialization is divided into two cases1, if the backpack requirements just fill the initialization f[0] = 0, f[1~v] =-inf;2, if do not need just fill f[0~v] = 0;
01 BackpackThere are n items and a backpack with a capacity of V. The cost of item I (i.e. volume, here
01 backpack, 01 backpack ProblemsI used to talk about backpacks in acm classes. However, they are simple, that is, a simple greedy problem. The problem is solved by sorting them first, and then processing them, it seems that it is more difficult than that. This requires traversing and finding the right one. The simple principle is as follows.
For example, we have a bac
Rt. Job Address http://zju.acmclub.com/index.php?app=problem_titleid=1problem_id=2123PS: (1) 01 The difference between a backpack and a complete backpack is the direction of calculation, 01 of the backpack is calculated from the top down, from the right to the left, the total backpack is from the top down, from left to
Full backpack:There are n kinds of items, each item has unlimited, the weight of each item is w[i], the value is v[i]. Now there is a backpack, it can hold a weight of C, Q: What is the maximum value your backpack can take away?Before the 01 backpack analysis, if the order, it means that the same item can be placed multiple times! This is the complete
(Hdu step 3.3.1) Big Event in HDU (01 backpack: place N items in a V-sized backpack. The cost of I-th items is c [I], the value is w [I]. Bigevent
Big Event in HDU
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission (s): 854 Accepted Submission (s): 345
Problem DescriptionNowadays, we all know that Computer College
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.