LA 4513 (Stammering Aliens-Hash for LCP) [Template: hash for LCP], 4513lcp
4513-Stammering AliensDr. ellie Arroway has established contact with an extraterrestrial civilization. however, all efforts to decode their messages have failed so far because, as luck wowould have it, they have stumbled upon a race of stuttering aliens! Her team has found out that, in every long enough message, the most important words appear repeated a certain number of times
tree), then try to find s[i in tire. L]. Specific reference code.The code is as follows:#include #include#includeusing namespacestd;Const intMAXN =4000* -+Ten;//4,000 words, each word the longest is 100, at most there are so manyConst intMAXM =300010;Const intMoD =20071027;intD[MAXM];CharSS[MAXM], t[ the];structtire{intch[maxn][ -]; intVAL[MAXN]; intsz; voidInit () {sz =1; Memset (Val,0,sizeof(Val)); memset (ch[0],0,sizeof(ch[0])); }//Initialize intIdxCharc) {returnA O'a'; }//Get number v
Topic PortalTest Instructions: Training guide P250Analysis: DFS memory search, the range or the graph is a known string composition of the automaton diagram, then by | (1 #include DP (Memory Search) + AC automaton LA 4126 Password Suspects
Test instructionsIn a sequence of length n, find the shortest length sequence so that it is greater than or equal to s;Ideas:pointer, water problem;AC Code:#include /*#include */using namespacestd;#definefor (i,j,n) for (int i=j;i#defineRiep (n) for (int i=1;i#defineRIOP (n) for (int i=0;i#defineRJEP (n) for (int j=1;j#defineRJOP (n) for (int j=0;j#defineMST (SS,B) memset (ss,b,sizeof (ss));typedefLong Longll;templateclassT>voidRead (tnum) { CharCH;BOOLf=false; for(Ch=getchar (); ch'0'|| Ch>
Test instructions: Given n balls, each time you take one from each basket and put it in a new basket, and remove the same, sort by the number of balls, ask you to complete the loop with a few balls.Analysis: Mathematical problems, it is easy to find the top N and is the largest number of balls, so we just need to find the largest n.The code is as follows:#include LA 7500 Boxes and Balls (math)
Topic PortalTest instructions: The small island of the convex polygon in the sea, ask the island's point to the sea farthest distance.Analysis: Training Guide P279, two-point answer, and then the entire polygon to internal contraction, if the half-plane intersection non-empty, then these points constitute a half-plane, there are satisfied points./************************************************* author:running_time* Created time:2015/11/10 Tuesday 14:16:17* Fi Le Name:LA_3890.cpp ***************
output for three test cases.Sample Input3 15 4 10 2 7 7 5 12 2 7 12 4 9 13 6 3 2 1 3 4 0 2 5 4 6 10 4 8 2 5 4 2 5 6 5 8 2 5 8Sample OutputYES NOYESThe main idea: to give you a lot of targets, each target is an interval and has its own height, ask you can in a given interval to find a straight line to all these targets strung together.Analysis: Look at the online solution to know the practice, two points archery position, and then maintain a section of elevation, if a target in the current inter
first instruction that gives the coordinates of the starting position. You may assume there is no more than instructions in each test case, and all the integer coordinates is in the range (-300, 300). The input is terminated if N is 0.OutputFor each test case there'll be one output line in the formatCase X:there is w pieces.,where x is the serial number starting from 1.Note:the figures below illustrate the and the sample input cases.
Sample Input50 0 0 1 1 1 1 0 0 071 1 1 5 2 1 2 5 5 1 3
Test instructions: Given a sequence of DNA of length n of M, a shortest sequence of DNA is obtained, which minimizes the total hamming distance.Hamming the distance is equal to the number of different positions of characters.Analysis: See this problem, my first feeling is to calculate the time complexity, good small, nothing, completely can violence, as long as the same position on each string,The choice appears most, if has the same choice ASIIC code small (because requires the dictionary order
not nuclear. That is, the angle sequence can not have two o adjacent, and the tail can not be at the same time O.Then we determine the number of R and O. The internal angles of the N-edged shape are (N-2) *180, and R represents the inner angle of 90,o for 270, so it is easy to calculate the number of R and O, respectively (N + 4)/2 and (n-4)/2. The problem is then converted to how many methods of placing (n-4)/2 O and any two nonadjacent are placed in n positions.This is a very simple combinato
Title Link: Https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudgeItemid=8page=show_problem problem=4846The main problem: the street equidistant distribution of n stores, numbered 1~n, the distance between adjacent stores is 1, someone from the initial position (0 points) to buy some items in each store, and shopping to meet some such as first to store a, then to store b restrictions, and finally reached the exit (N+1 point). Ask this person what the shortest way to go for a shoppin
characters long. There'll be no, identical words and all letters in the words would be lowercase.There is a blank line between consecutive test cases.You should proceed to the end of file.OutputFor each test case, the output of the number, as described above, from the task description modulo 20071027.Sample InputABCD 4 a B cd ABSample OutputCase 1:2Test instructions: Given some words, and a long string, ask this long string split into existing words, can split into several waysIdeas:Dp[i]=sum (
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.