The meaning of shell variable $#,[email protected],$0,$1,$2 in Linux is explained:Variable Description:$$The PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?End code of the last Run command (return
N queen's question
Time Limit: 2000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)Total submission (s): 4933 accepted submission (s): 2252Problem description places n queens on the square board of N * n so that they do not attack
Bloggers have not touched the front end of the web before, and recently began to learn. In the study of the same time, I hope to continue to collate summary. So I have this blog. Bo Master technology Shallow, and for the first time to write such a
Given n kinds of goods and a backpack. The weight of item I is WI, its value is VI, the capacity of the backpack is C. Q. How do you choose which items are loaded into your backpack so that the total value of the items loaded into your backpack is
Backpack problems, 0-1 backpack Problems
Greedy
Description
Now there are a lot of items (they can be separated), and we know the value v and weight w of each item (1
Input
Enter a positive integer n (1 Then there
"Ran out of trampolines of type 0/1/2" run-time errors usually occur when using a large number of recursive generics. To see this error you need to connect the device directly to the device to run debugging in order to see, you can imply that the
Idea: recursive solution of enumeration Split points, which can be optimized by DP.
Pay attention to recursive termination conditions.
Note ^ & | there are three different statistical conditions.
import java.util.HashMap;import
1 // accepted 240 KB 188 MS 2 // 0-1 backpack 3 # include 4 # include 5 # include 6 using namespace STD; 7 const int imax_n = 3405; 8 const int imax_m = 12885; 9 int f [imax_m]; 10 int weight [imax_n]; 11 int factor [imax_n]; 12 int n; 13 int m; 1
Link: poj 3628 bookshelf 2
Bookshelf 2
Time limit:1000 ms
Memory limit:65536 K
Total submissions:7462
Accepted:3436
Description
Farmer John recently bought another bookshelf for the cow library, but the shelf
The first backpack problem, 0-1 backpack, refer to the one written by Daniel on the Internet. State equation: DP [I] [W] = max {DP [I-1] [W], DP [I-1] [w-OBJ [I]. wei] + OBJ [I]. val]}, but this will exceed the memory, and a space complexity
This year:
There is disappointment, there is confusion, there is happiness, there are sad, there is loneliness, there is fear, there are expectations ... The pride is that I have survived;
Get started with the front end and find the job;
The problem is to find a solution that makes the diagram fully connected and minimizes all side costs and distances\ (\sum_{i∈e}cost_i\) divided by \ (\sum_{i∈e}dis_i\) minTwo-part solution can be consideredYou can assume that this value is less
Question: The standard 0-1 backpack. Use a scrolling array for memory. In terms of time, you can first sort W [] in non-ascending order. We originally planned to record the minimum weight during data input and optimize it during knap. However, we
The meaning of the shell variable $ #, $ @, $0, $1, $2 in linuxVariable description $ shell's PID (processID) $! Background ProcessID $? End code of the last command (Return Value) $-Flag list Set using the Set command $ * List of all parameters.
Linux variables #, @, 0, 1, 2, *, $, $? Linux VariablesLinux variables #, @, 2, *, $, $
Let's first write a simple script and then explain the meaning of each variable after execution # touch variable # vi variable script content is as follows :#! /
In Linux, shell variables $ #, $ @, $0, $1, $2 are interpreted as follows:
Variable description:
$ PID (ProcessID) of Shell itself $! PID of the background Process last run by Shell $? End code of the last command (Return Value) $-Flag list Set
First look at an unoptimized two-dimensional space DP:
#include #include #include #include using namespace std;const int maxn1=3500;const int maxn2=1300;int dp[maxn2][maxn2];//int dp[maxn2];int w[maxn1],v[maxn2];int m,n;int max(int x,int y){ return
First, what is the problem to be solved: a fully Weighted Graph with each edge having its own cost value cost [I] and benefit value benifit [I]? if X [I] is used to represent an edge or not, a spanning tree is obtained. Requirements: r = (Σ cost [I]
The idea of this topic is clever. Under what circumstances can all the remaining items be put down? That is, the smallest of the remaining items cannot be placed. Therefore, first sort items by capacity from small to large, and enumerate the
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.