Link:
Uva:http://uva.onlinejudge.org/index.php?option=com_onlinejudgeitemid=8category=24page=show_ problemproblem=1828
Type: Hash table
Original title:
A language is a set of strings. And the concatenation of two languages is the set of all strings this are formed by concatenating the strings of the Secon D language at the "strings of the" the "the" the "the" the "the".
For example, if we have two language A and B such that:
A = {cat, dog, mouse}
B = {rat, bat}
The concatenation of A and
There are n equidistant villages in a straight line, and each village either buys wine or sells alcohol. Transporting K-units of wine from one village to the neighboring village requires a workforce of k units. Ask at least how much labor is needed to meet the needs of all villagesThinking greedy#include UVA 11054 Gerovia Wine Trading (greedy + tree-like array)
Topic Link: Click to open the linkTest instructions: At first there is only one node on the server, in order to let all the leaf node distance from the server is not more than K, we add the server on the non-leaf node, ask the least how many servers to add.Idea: Greed. The first server node as the root node, the downward expansion, record the parent-child relationship, the depth of the leaf node to sort, starting from the deepest node to find the K-Distance parent node, install the server, and a
line of each block there is the number of places N N lines contains the number of a place followed by the numbers of some places to which t Here are a direct line from the this place. These at the very N lines completely describe the network, i.e., each direct connection of both places in the network is contained at least in one row. All numbers on one line is separated by one space. Each block ends with a line containing just 0. The last block had only one line with N = 0.OutputThe output cont
High-connectivity components of the uva-1 11504 Dominos
Q: If a domino card has an edge u-> v, it means that u has fallen v automatically. The minimum number of manual push requests is required.
If some cards belong to the same strongly connected component, if any card is pushed down, all cards are pushed down. After the point can be scaled down through strong connectivity, there must be no card of entry level.
Note that this question cannot be use
UVA 261-the Window PropertyTopic linksTest instructions: The problem test instructions quite round. is given a string length n, the scan length is k = [1,n], and then can only scan consecutive K characters of the substring, requiring all scans, each scan will appear in the number of different strings are not more than k + 1, then this string is the Window property, if not, You also need to find the lowest subscript of the non-conforming position (that
Topic Link: UVA 11123-counting trapizoidTopic: Given a number of points, ask how many kinds of trapezoid, not including the rectangle, trapezoidal area must be positive. Because it is a collection of points, it does not have the advantage of repeating points.Problem-Solving ideas: Enumerate 22 points, find out the line, including the slope k, the offset value C, and the length L. The nature of the trapezoid is known, a pair of pairs of sides parallel,
Title: give you some lowercase letters, and some of the partial order pairs of lowercase letters, to find out all the permutations that satisfy the partial order relationship.Analysis: Graph theory, search, topological sort. Ontology can be directly topological partial order, here directly search;It is possible to reach the next point by judging the partial order relationship.Description: Last week, Sunday went home to ╮(╯▽╰)╭.#include UVa 124-followi
N (nThis problem can be solved in a queue, the queue is a special linear structure, only allow the queue header (head) to delete, become "out of the team", and in the queue header (tail) inserted, called "Queued."Queue problem Solving ideas are as follows:The first step, to delete the first number, first think about how to delete the first number of arrays, the simplest way is to move all the numbers back one, the previous number is overwritten. But if you move it every time, it's time-consumin
Test instructionsGive you an n-bit integer, let you delete the D number, the remaining number should be as large as possible.Analysis:Vector array simulation was used. If the number of the last digit in the >vector array that is currently being inserted is replaced and d--Code: #include #include #include #include using namespace Std;Vectorint main (){ int n,d; while (~SCANF ("%d%d", n,d) n) { int len=n-d; S.clear (); GetChar (); for (int i=0;i {
Title: Give a number (beginning with 0), take out the D number, so that the remaining number is the largest (the order can not be changed).Problem analysis: Take out the D numbers, and leave n-d numbers left. The equivalent of the number of n numbers in order to select the n-d number of the largest, of course, the use of window sliding priority selection of large.The code is as follows:# include UVA-11491 Erasing and Winning (monotone queue)
Test instructions: give you an n-bit integer, let you delete the D number, the remaining number should be as large as possible.Solution: Because the last digit number is determined, and the low number of the answer contribution is not necessarily high number, so preferred to choose the largest and most on the left of the number, but there is a limit, choose this number after the left of the number to ensure enough next choice, so I think of the priority queue, record a message, The position of t
Title meaning: There are N cards, marking for 1~n, and cards to fold good, from the top to the small is the label 1~n card, as long as the number of cards heap is greater than or equal to 2, take the following actions: The top of the card to throw away (that is, leaving the heap). The card just left, then the new top card placed in the last card heap.Output required: Output The discarded cards sequentially, and output them in the order they were discarded. Finally, the last card to be left is ou
];/// Save this node's father nodeintN,M,Time,Top;///time point in time, top for stack operationsVectorVectorint> >G;voidInit(){G.Clear();G.Resize(N+1);Memset(Low,0,sizeof(Low));Memset(Dfn,0,sizeof(Dfn));Memset(Father,0,sizeof(Father));Time =0;}voidTarjan(intU,intFa){Low[U] =Dfn[U] = ++Time;Father[U] =Fa;intLen =G[U].Size(),V; for(intI=0;ILen;I++) {V =G[U][I];if(!Dfn[V]) {Tarjan(V,U);Low[U] =Min(Low[U],Low[V]); }else if(Fa !=V)if we write here Low[u] = min (Low[v], low[u]), then it is equ
UVA-10603-Fill (BFS + priority queue)
There are three jugs with a volume of a, B and c liters. (a, B, and c are positive integers not greater than 200 ). the first and the second jug are initially empty, while the third
Is completely filled with water. it is allowed to pour water from one jug into another until either the first one is empty or the second one is full. this operation can be performed med zero, one or more times.
You are to write a pro
Title Link: http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=36239Test instructions: gives you the interval of the sequence and the positive and negative, requires constructing a set of sequences to satisfy the condition.Converts to prefixes and, for topological sequences.Code:#include #include #include #include #include using namespace STD;Chars[123];intNintsum[ the];intdu[ the], is[ the][ the];voidToposort () { Queueint>Que while(!que.empty ()) Que.pop (); for(inti =0; I if(Du[i]
length and is the longest possible co Mmon sequences. For example in the strands atgc and GCTG, the longest common sequences isGC and TG.Input and OutputWrite A program that accepts as input strings representing DNA strands, and prints as output the longest common se Quence (s) in lexicographical order.If there isn ' t any common sequence between the strings, just print: 'No common sequence.'If there is more than one test cases, it must is a blank line between the consecutive, both in input and
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.