I have done several questions about the maximum continuous sub-columns. This question is to find two sub-columns with known lengths to meet the and maximum conditions of these two segments. The core is dynamic and tree arrays.
Tree array: the
It is better than the gourd painting scheme. According to the uva439 idea, we only change the two-dimensional array to three-dimensional, because the calculation of U is so careless that wa is 6 or 7 times, 55555555, And so careless.
# Include #
Write down the two associated points, and then DFS. N is 5*10 ^ 4, so we cannot open a two-dimensional array of num [N] [N], but we can use vector
# Include # include # include # include # include # define maxn 50010 using namespace STD;
My biggest mistake in the competition: the two numbers I entered were wide and high, but I did not notice that they were always high and wide until the end of the competition without AC, in fact, the idea is correct.
# Include # include using
It is actually a simple question. The important information is the first necessary and sufficient condition provided.Based on this, we can determine whether [M, N] is a factor of [p, q.
How can we find the M and N that meet the requirements? You
M * n = P and m and n are all prime numbers, so it must be M. N is larger than SQRT (P) and one is smaller than SQRT (P, or m = n = SQRT (P), so when constructing a prime number table, you can judge SQRT (10 ^ 9.
# Include # include #
I really admire the DC senior and asked him how he got the recursive formula. He said that he was drawn out after drawing on the paper. Okay ..... However, with his guidance and help, I thought carefully and finally realized this question.
1. 1-2,
When I first saw this question, I thought it was done by using the dynamic method to find the longest public subcolumn. In fact, only one for enumeration can judge the length of the loop. It's complicated ........
# Include # include # include
This question corresponds to uva10700http: // response. The state transition equation of DP used by CDC is clever. Use Maxx [I] [J] to represent the maximum value of the part where the start point is at the I end point in J, state transition
Worship .... He thought of such a good way to use BFS + priority queue, http://blog.csdn.net/xlc2845321/article/details/9819269
However, I tried to mark the second dimension with Len or price without using the VIS array.
# Include # include #
Link: http://www.spoj.com/problems/PT07X/
This question can be done with greedy ideas. node A is associated with Node B. If the level of node A is 1, it is better to delete node B, in this way, find all nodes with a degree of 1, delete the nodes
After the competition, I was told that it was a DFS question. I had the place where I enumerated =. Then I checked whether the results on both sides were the same, each position on both sides of the equal sign is either placed with + or not. In
This question is more difficult .... But it mainly involves three points:
1: the IP address is composed of four integers and three. 2: The integer must be in the range of 0-, and the number of digits of the integer is 1-3. 3: No characters except
C. Front () returns the first element
C. Back () returns the last element.
C. push_back (e) Insert Element E at the end
C. pop_back () Delete the last element
C. Clear ()
C. Erase (POS) deletes the POs position Element
C. Erase (beg, end) deletes
Today, I roughly learned the Extended Euclidean algorithm.
Set A, B, and C as any integer, and G = gcd (A, B). The solution of the equation AX + by = G is (x1, Y1 ), when C is a multiple of G, a group of solutions for AX + by = C is (x1 * C/g, Y1 *
Question Link
Wa many times, because of a small error,
# Include Using namespace STD;Int f [1000001];Int main (){Int A, B, n, I, time;While (scanf ("% d", & A, & B, & N) & (A | B | N )){F [1] = 1;F [2] = 1;For (I = 3; I 7, so each result can have a
Online judge
Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)Total submission (s): 3878 accepted submission (s): 1452Problem descriptionignatius is building an online judge, now he has worked out all the problems
S-trees
A strange tree (S-tree) over the variable set is a binary treerepresenting a Boolean function. Each path of the S-tree begins atRootNode and consistsN+ 1 nodes. Each of the S-tree's nodes hasDepth, WhichIs the amount of nodes
Question Link
DescriptionAstequalmers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. let the level of a star be an amount of the stars that are not higher and not to the right of
Recursive learning ..... I feel that this question is mainly used for recursion. The Code is as follows:
#include#include#includetypedef struct Node{ int val; struct Node *left,*right;} Node;int n,m;int num[85];Node *buildtree(){ scanf("%d"
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