# Include # Include # Include Using Namespace STD; Int P [ 1005 ], W [ 1005 ], DP [ 1005 ] [ 1005 ], N, V; Void DP () {memset (DP, 0 ,Sizeof (DP )); For ( Int I = 1 ; I I ){ For ( Int J = V; j> = 0 ;-- J ){ If (J> = W [I] & DP [I- 1 ]
This is a pure simulated question. You only need to simulate it carefully. At the beginning, you changed the row-column relationship according to your own ideas, and the results were in disorder. After this certificate, the AC.
CodeAs follows:
#
It is a snake matrix, then the prime number is filtered out to mark the final BFs. Pay attention to the number path between 1-, but it does not mean that we only need to print the prime number in this range, because it is very likely that the edge
I did not pay attention to this topic. As a result, the error was found many times and I still did not find the error.
The cause is that the ancestor node is directly searched for when the first round of finding the node with zero inbound level.
Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1505
Self-written diaosi code:
#include #include #include #define MAXN 1050using namespace std;int N, M, u[MAXN][MAXN], l[MAXN][MAXN], G[MAXN][MAXN];inline int max(int x, int y){ return x > y ? x :
Simple Dynamic Planning: divides cubes into six, and then sorts them in double order. Then, DP is enough.
For the current square, select the maximum value of the square that can be placed in front and the height of the square.
The Code is as follows:
01 backpack bare template questions
# Include # include # include # define maxn 1005 using namespace STD; int N, V, p [maxn], V [maxn], DP [maxn]; inline int max (int x, int y) {return x> Y? X: Y;} void zobag (int x) {for (INT I = V; I> = V [X];
Given a chessboard, some vertices are deleted and asked how many 1*2 dominoes can be placed in it at most in this case.
This problem can be solved by Bipartite Graph Matching. By copying a two-dimensional graph, two adjacent points of Domino can be
I won't say much about the meaning of the question. At the beginning, I was still using search to write the question. I set two directions, marked with de-duplication, various types, and then it's TLE.
The positive solution is the number of holding
The question is the question of probability. It means to rob Bank A. the probability of being caught is Ai. The probability of being captured is bi, therefore, the probability of not being caught is (1-ai) * (1-bi )...... therefore, we use the
This is a purely simulated question and does not require any algorithms. Define the sorting rules when selecting a piece and sort it out at a time.
The Code is as follows:
# Include # include # include # include # include using namespace STD;
The meaning of the question is very simple. Remember to use State compression when getting the number (1) of squares. Here, the number of rows and columns is too large to be compressed. Therefore, we need to use the thought of minimizing the largest
This question is directly two for loops, so here we need to hash and then sort them once, so that we only need to compare the two adjacent strings with the same hash value.
The Code is as follows:
# Include # include # include # include # define
Calculates the minimum number of characters that need to be changed throughout the automobile evolution. The calculated number of characters is 1-7 characters.
The Code is as follows:
#include #include #include #include using namespace
This is a simulated question that may be difficult to understand.
The first sequence means: A [I] indicates the number of left brackets on the left of the I-th right brace.
B [I] indicates the number of left parentheses between the right brace I and
The most direct minimal spanning tree.
The Code is as follows:
#include #include #include #include using namespace std;int N, pos, set[105];struct Node{ int x, y, dist; bool operator
This question can be directly divided into two parts. Pay attention to the return value of the second part. It is best to manually simulate it in the future.
The Code is as follows:
# Include # include # include # include using namespace STD;
We can refer to the switch question, but here is the minimum number of operations, so we need to enumerate the variable to calculate the minimum number of changes in all cases.
The Code is as follows:
# Include # include # include # include #
This question can be used even in Java, because it is the simplest. Of course, the writing of the two for loops is also very simple. Here we will directly write the method of prime factor decomposition.
For the number in a, we can decompose each
The Code is as follows:
# Include # include # include # include # define to (x, y) (x-1) * n + yusing namespace STD; char G [30] [30]; int dir [4] [2] = {1, 0,-1, 0, 0, 1, 0,-1}, N; int C; inline bool judge (int x, int y) {If (x N | Y N)
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service