Problem solving Report of line tree and monotonous queue optimization DP---POJ2373

The sprinkler head is installed on the grass (which can be regarded as a line segment) with the length of L ( The adjustment range is [a, B]. Each vertex of the lawn must be covered by only one sprinkler, and some continuous intervals must be

Use two stacks to solve the source code of arithmetic expressions

Note:1. contains only parentheses () and four arithmetic operations of the +,-, *, And/binary operators.2. For more general solutions, refer to recursive solutions and expressions tree solutions. [Cpp]# Include # Include # Include # Include #

HDU1856 (More is better)-query set + tree

[Java]Package D0813;/** Questions: mr wang puts a group of children in a room. Some of these children are friends,* Mr wang selects some children from the room each time and asks you at most a few children (the children must be friends,* It can be

Poco: Path & amp; Poco: File

Background: On unix and windows, the path representation is different. On windows: Node: \ Device \ Paths, on linux:/Paths. The delimiters in the path are different. One is a backslash and the other is a forward slash. The separators between two

Special topics on prime numbers

[Cpp]# Include # Include  Using namespace std;Const int nmax= 10000000;Int isPrime [nMax];Int prime [nMax];Int factor [nMax];Int len;  Void f1 () // simple Filter{Int n; // calculates the prime number between [1, n ].Scanf ("% d", & n );Len =

POJ 2057 The lost house

This question is expected. First, when you see the expectation, you will think of dividing the problem into several subproblems and calculating the expectation separately. Therefore, you can use dynamic planning for this question. Note that the

Hdu_4368 Water World I (Computational ry)

Question:N columns are arranged in one row, and the angle is tilted. The left direction is positive, and the right direction is negative. The maximum water accumulation is obtained.Ideas:Find the highest pillar after the tilt, and then find the edge

Foj 2075 Substring

Calculate the string with the smallest Lexicographic Order that exactly appears n times. Question: When the suffix array is added with a monotonous stack and n is set to 1, it must be judged. However, the data is a bit watery and can be passed

Zoj1060, poj1094 -- topological sorting

Description:Given the first n letters of the alphabet, and the relationship between these letters (such a relationship is given to m groups ), whether the entire order of n letters can be determined by the m group relationship. If the order of n

Microsoft and other data structures and algorithms interview 100 questions 13th questions

13th questionsQuestion: enter a one-way linked list and output the k-th node in the list. This question is relatively simple, is for this linked list, define two pointers head1 head2, and then let head1 forward a K-1 position after head2 and head1

Std: memory_order of c ++ 11

First of all, it is clear that std: atmoic and std: memory_order are used only when there are multiple CPUs and threads. In x86, because it is strong memory order, you only need to consider the memory order optimized by the compiler. For the sake of

Powerful functions for element replacement in c ++ STL

The objective of learning C ++ STL is not to make our programming more complex, but to make our programming simpler, for example, a powerful function replace can be used to replace C ++ string characters. Its Syntax declaration is as

Hdu 1052 Tian Ji -- The Horse Racing

I think it's okay to submit the program to WA. My heart is really "cool and cool. When it's AC, there's a mixture of feelings ......Hey, the question is actually very simple, but you must clarify your ideas. Ideas: (explanation of my code)1: Sort

HDU 3401 Trade [monotonous queue + dp]

Question: I know the daily purchase and sale prices, the maximum Purchase and Sale limits, and the maximum number of votes that can be held for a stock. What is the maximum benefit after n days.[Cpp]# Include # Include # Include # Include # Include  

POJ 2942 (point dual-connected component of Tarjen + cross staining)

This is a vertex-connected component. I first wrote an edge ......First, the connected components may overlap ...... (3.6)There are two groups of Dual-connected components: (, 3) and (,).So we must judge in Tarjen ...... Note the special judgment

HDOJ 1597,1058

I made another big question for a day. Write them together. HDU1597 Code: [Cpp]# Include # Include Using namespace std;Int main (){Int k;_ Int64 x, n;Scanf ("% d", & k );While (k --){Scanf ("% I64d", & n );X = int (sqrt (n * 2.0 ));While (x * x + x>

SGU 411 Petya the Hero

[Cpp]Calculate the longest public return string of two strings, and output one string randomly. # Include # Include # Include # Include  Using namespace std; # Define maxn10100 Int rad [MAXN];Char s [MAXN]; Char r1 [MAXN/2], r [MAXN];Int sa

Thinking about a thunder pen question? -- Random Algorithms are not repeated.

For a non-repetitive random algorithm, you can calculate 0 ~ N does not have repeated m numbers. [Cpp]# Include # Include Using namespace std; Void knuth (int n, int m){Srand (unsigned) time (NULL ));For (int I = 0; I {If (rand () % (n-I) {Cout M --;

CodeForces Round #119 (187B)-AlgoRace

I have been thinking about this question for a long time ~~ I only came up with dp [60] [60] [60] [1000], which is completely inefficient. (During update, I also need to scan 60 ^ 3 space... so .. the efficiency is 1000*60 ^ 6 .. ...)... I suddenly

POJ 3696 The Luckiest number (08 Hefei number theory)

Question: Give a number n and find a multiple of them. Each digit of this number is 8. Find the smallest digit. Otherwise, 0 is output.   It is actually a very interesting number theory, and the code is not very difficult. But it is a pity that not ~

Total Pages: 5902 1 .... 4838 4839 4840 4841 4842 .... 5902 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.