Timus-1507 amount of degrees by bit DP

Http://acm.timus.ru/problem.aspx? Space = 1 & num = 1057 In fact, this question can be regarded as a question of the number of combinations, mainly to convert from other hexadecimal to binary-based.AlgorithmIf one digit is not 1, it is not

HDU-pattern and text Enumeration

This question is not to consider the situation at every moment, but to consider the overlay effect of each bit at all times. For a string of LF and a substring of LS, the matching length of each character is lf-LS + 1. CodeAs follows: # Include

HUT-XXXX money out of thin air line segment tree

This topic defines the structure of a company and then performs a series of operations on each employee. Because the problem involves an employee and a department led by an employee, it is obviously inefficient to use a general linear structure. The

POJ-3278 catch that cow BFS

The strange stair with hangdian is very curious. The Code is as follows: #include #include using namespace std;struct Node{ int x, t;}e[100005], pos;int N, K, front, tail, hash[100005];void getnewpos(int x, int a[]){ a[0] = x - 1; a[1] = x +

Hut-4302 holedox eating line segment tree

This question is about a small thing living in a pipe with a length of L. There are some cakes in it. Now, the coordinates of the cake are dynamically given. The coordinates of the small items are initially 0, when the command is to eat a cake, the

POJ-2034 (Anti-prime sequences DFS)

Screen out the prime number and then directly use brute force. The Code is as follows: #include #include #include #define MAXN 10000using namespace std;int N, M, d, p[600005];int hash[10005], path[10005];void pre(){ int k; for (int i = 4; i = 2

HDU-4339 query line segment tree + Polynomial Interpolation hash

This question is mainly to optimize the comparison of the two strings, and cannot be matched from the starting position each time. Here we use the line segment tree for optimization. we can update and maintain the hash values of each segment, and

HDU-expression Enumeration

Find all the parentheses, enumerate all the possibilities, and use strcmp to sort them in the lower order. The method used by the program is better. You can directly mark which bracket group each bracket belongs to, and then directly extract the

HDU-If You Are the One

This question cannot be solved by using the Hungary algorithm, and there are too many sides. With simple greedy rules, we choose the best matching scheme each time for matching. In terms of division, we use a negative wage requirement to find people

HDU-4336 card collector exclusion theorem or probability DP

First, the expected DP can be used to calculate the final expected value. Because the probability of each card is different, so it is not like the POJ-2096 that DP [I] indicates that I card is taken to represent the State, but to open a 1 For DP [I]

HDU-binary operation

Finally, the meaning of the question can be directly abstracted into the number of all numbers multiplied by the number of 1, and then the number of each digit is restored. In our own practice, we also enumerate every binary bit. For AI, AI + 1...

HDU-4324 triangle love topological sorting

For such a question with such strong restrictions (any two points must have edges and one-way edges), it indicates that there are various solutions, even the AC rate of the Randomization method is not too low. Considering that there will not be two

Linear filtering of prime numbers

The linear regression method is called linear because it only uses its smallest prime factor to filter out each sum. The Code is as follows: # Include # include # include # define maxn 1000000 using namespace STD; int P [1000005], PRI [1000005],

HDU-4274 spy's work DFS search

Given a series of tree relationships used to describe the personnel relationships of the entire company, we now ask whether there is any conflict between the given relationships. During the competition, I was confused. In fact, this is not very good

HDU-4279 number Euler's function, comprehensive factorization

Given a number N, the number p in the determination (1-N) satisfies gcd (n, p )! = 1 & N % P! = 0. When a number has an odd number in (1-N), it is advisable to count a certain range [, b. The general idea is to subtract the intervals to solve the

POJ-1416 shredding company Enumeration

Given two numbers, the length of these two numbers cannot exceed 6 digits. Then, how can we determine the split of the last number to bring the value closer to the previous one, in fact, this problem is equivalent to inserting a board in the next

HDU-3415 Max sum of max-K-Sub-sequence monotonic queue

This is to examine a monotonous queue. When we do this, we should note that because of the first and end connections, we will expand the space to simplify this process. Define f [J] to indicate the maximum sum of the consecutive lengths ending at

Number of combinations of POJ-1942 paths on a grid

Note that the output result is also within 32-bit unsigned. The Code is as follows: # Include # include # include # include using namespace STD; typedef long int64; int64 C (int64 A, int64 B) {int64 ret = 1; for (INT I = 0; I  

HDU-tricks in BITs YY

The problem was solved by DP at the beginning, but it was wrong to think about it, because such bit operations could not obtain the optimal solution until the last computation, that is, there was no optimal sub-structure. First, when a and B perform

HDU-travel by airline DP

Find the longest way back and forth from one point. Converts a problem to two non-intersecting paths from a point to a point N. Define DP [I] [J] to indicate the maximum number of vertices that the first vertex has reached the I point, and the

Total Pages: 64722 1 .... 55852 55853 55854 55855 55856 .... 64722 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.