Address: poj 3250
Monotonous stack for beginners. Multiple schools and online competitions have already met each other twice.
The monotonous stack principle is simple and cannot be simple .. It is to make the elements in the stack monotonically from the top of the stack to the bottom of the stack.
For example, incremental and monotonous stacks.
If the number at the top of the stack is smaller than the number at the top of the stack, pop the number at
Bad Hair DayTest instructions: to N (n Idea: Each head to the stack of cows, the top of the stack than its dwarf cattle out of the stack, because these cows have no chance to see the cattle back, so out of the stack, then add the number of elements in the stack can;#include #include#include#includestring.h>#include#include#include#include#include#include#includeSet>#include#includeusing namespacestd;#defineRep0 (I,L,R) for (int i = (l); i #defineREP1 (I,L,R) for (int i = (l); I #defineRep_0 (i,r
POJ 3250 Bad Hair Day simulated monotonous Stack
Bad Hair Day
Time Limit:2000 MS
Memory Limit:65536 K
Total Submissions:14989
Accepted:4977
Description
Some of Farmer John'sNCows (1 ≤N≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see the top of other cows 'heads.
Each cowIHas a specified heightHi(1 ≤Hi≤ 1,000,00
Poj 3250 Bad Hair Day (monotonous stack)Bad Hair Day
Time Limit:2000 MS
Memory Limit:65536 K
Total Submissions:14883
Accepted:4940
Description
Some of Farmer John'sNCows (1 ≤N≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see the top of other cows 'heads.
Each cowIHas a specified heightHi(1 ≤Hi≤ 1,000,000,000) and
Press Stack once ESP-4,EBP unchangedESP is the stack-top pointer register, and the stack operation is only related to ESPFor example, there is a function A, there are two parameters, which is generally the casePush 1 parameter 2 pressure stack, esp-4Push 2 parameter 1 pressure stack, esp-4Call a callsA:PUSH EBP Save EbpMOV ebp,
Guidance: From: poptown.gamewan.com/bbs E-MAIL: meila2003@163.com 1. Preface On the forum, I saw many friends who did not know what is the ESP law, what is the scope of application of ESP, what is the principle of ESP law, and how to use the ESP law? I saw my findings in the "" investigation and found that
. Introduction
Encapsulation security load header provides a hybrid security service in IPv4 and IPv6. ESP can be applied separately, used together with the IP address Authentication Header (AH), or nested, for example, tunnel mode (see "security architecture for the Internet Protocol" [ka97a], the "security architecture document" is used in place below ). Security services can be implemented between one communication host, one communication security
http://poj.org/problem?id=3250
Bad Hair Day
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 15956
Accepted: 5391
DescriptionSome of Farmer John ' s n cows (1≤ n ≤80,000) is has a bad hair day! Since Each cow was self-conscious about she messy hairstyle, FJ wants to count the number of other cows so can see the
queue from the end of the team, remove a straight column that is no less than it, and calculate a possible solution (do something here in the above pseudo code) while removing it ).
Application-poj 3250
Question (not strictly translated): There are n heads of ox heads standing in the east to form a column. Each ox has a certain height and can see the head of the ox whose front height is lower than it until it is blocked by a ox whose front height i
Question link: http://poj.org/problem? Id = 3250
Train of Thought Analysis:
The question requires the sum of the number of cows that each ox sees, that is, the sum of the number of times each ox sees;
How can we determine the number of times each ox is seen?
For a particular ox, the ox who sees it must be on its left, and its height should be higher than that of the ox, therefore, you only need to calculate the number of cows whose height on the left
Recently, when I was learning about encryption and decryption and used od for disassembly, I studied compilation again .. In particular, we made an in-depth study on ESP .. The following information is found on the Internet. Let's take a look at it here ..
There are many registers in the register, although their functions and use are no different, but in the long-term programming and use, in programmer habits, each register has been assigned a special
I often see the ESP Law in the tutorial. Now I will tell you what the ESP law is. What is its principle?
!! (Too useful ◎)
BTW: After Reading 18 articles about manual shelling, reading this article may be more helpful to you!
2. Preparations before we begin to discuss the ESP law, I will explain some simple assembly knowledge to you.1. callThis command is a ba
The concepts of register ESP and EBP are always confused. View and define esp as the stack top pointer, and EBP as the access Stack pointer. Still cannot be fully understood. Later I used a piece of assembly code to have a clear understanding of the two.The following is the assembly code for calling the test (INT P1, int P2) function according to the call Convention _ stdcall.Suppose that the pre-function S
the sum of C1 through CN. For this example, the desired is answer 3 + 0 + 1 + 0 + 1 + 0 = 5.InputLine 1:the number of cows,N.Lines 2..n+1:lineI+1 contains a single integer which is the height of cowI.OutputLine 1: A single integer which is the sum ofC1 throughCN.Sample Input610374122Sample Output5Main topic:n number, row from left to right, ask each number to the right of the number of smaller than he has a few, and then sumYou can think back, see how many numbers he has on his left, and then a
. For this example, the desired is answer 3 + 0 + 1 + 0 + 1 + 0 = 5. InputLine 1:the number of cows, N. Lines 2..n+1:line i+1 contains a single integer so is the height of the cow I. OutputLine 1: A single integer which is the sum of C1 through cN. Sample Input610374122Sample Output5SourceUsaco 2006 November Silverso the cows are facing to the right, ox I can see the cow J when and only when imaintenance of a monotonic stack, from left to right scan h[i], (1) when the stack is empty, the h
Test instructionsA row of cows stood in a row, giving the height of a cow, and each cow could only look right, with a c[i for each cow]C[i] For I can see how many cows, short cows see high cattle, ask all c[i] and is how much.Ideas:We convert, in fact, to find out how many times each cow can be seen, and apparently it can be seen by cows that are monotonically increasing to the left.Then we maintain a monotonous stack, each time will be less than equal to its stack, then the number of elements i
Bad Hair Day
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 14989
Accepted: 4977
DescriptionSome of Farmer John ' s n cows (1≤ n ≤80,000) is has a bad hair day! Since Each cow was self-conscious about she messy hairstyle, FJ wants to count the number of other cows so can see the to P of other cows ' heads.Each cow i have a specified height hi (1≤ hi ≤1,000,000,000) and is standing in a line of cows All facing east (to th
Corn fields
Time limit:2000 ms
Memory limit:65536 K
Total submissions:7798
Accepted:4159
Description
Farmer John has purchased a lush New Rectangular pasture composedMByN(1 ≤M≤ 12; 1 ≤N≤ 12) Square parcels. he wants to grow some yummy corn for the cows on a number of squares. regrettably, some of the squares are infertile and can't be planted. the cows dislike eating close to each other, so when choosing which squares to plant, he avoids choosing squares tha
Topic Link: Poj 3250 bad Hair Day
Bad Hair DayTime limit:2000ms Memory limit:65536kTotal submissions:16700 accepted:5621Description
Some of farmer John ' s N cows (1≤n≤80,000) are have a bad hair day! Since Each cow are self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can P of other cows ' heads.
Each cow i has a specified height hi (1≤hi≤1,000,000,000) and are standing in a line of cows all facing Ght in our d
1. Understand the EBP register
There are many registers in the register, although their functions and use are no different, but in the long-term programming and use, in programmer habits, each register has been given a special meaning by default. For example, EAX is generally used for return values, and ECX is used for counting. In the win32 environment, the EBP register is used with the ESP value stored after the call is entered, so that 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.