Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 4848
I didn't even look at this question during the competition, but it's not hard ....
But to be honest, I still don't quite understand the meaning of the question ......
Errors:1. floy cycle order error,
2. When searching, you should first judge whether I can be searched (that is, whether it is possible to produce a solution), and then Mark vis [I] = 1, I marked vis [I] = 1 first, and then determined whether I can be searched. This will certainly
Title: Uva-10280old Wine into New bottles (full backpack + pruning)The main topic: Now to put the old wine into the new bottle, each bottle has the smallest maximum capacity requirements, and then give you l wine, in the give you n bottles, each bottle of the specification also give you, each kind of bottle supply is unlimited, ask how to arrange these wine to make the remaining wine the least.Problem-solving ideas: The problem is a complete backpack,
DescriptionGeorge brought a set of equal-length sticks and cut them randomly, making each stick less than 50 units in length. He then tried to restore the sticks to a pre-cut state, but forgot how many sticks and the initial lengths of the sticks were initially. Please design a program to help George calculate the possible minimum length of the stick. The length of each stick is represented by an integer greater than 0.InputThe input contains multiple sets of data, each of which consists of two
Output 2"809HINT
"Data Range"For 30% data, guarantee 1 For 100% data, guarantee 1 Source
Day12393:cirno's Perfect arithmetic classroom
Time limit:10 Sec Memory limit:128 MBsubmit:299 solved:183[Submit] [Status] [Discuss]
Description~cirno found a Baka number, this number ~ only contains 2 and ⑨ two kinds of numbers ~ ~ Now Cirno want to know ~ ~ a range of how many numbers can be divided by Baka number ~ but Cirno so genius of the Goblin only disdain to count it can only rely on the s
cases. The first line of all test case contains three integers n, m, and T (1 ' X ': a block of wall, which the doggie cannot enter;' S ': The start point of the doggie;' D ': the Door; Or'. ': an empty block.The input is terminated with three 0 ' s. This test is a not-to-be processed.Outputfor each test case, print on one line "YES" if the doggie can survive, or "NO" otherwise.Sample Input4 4 5S. X... X... Xd.... 3 4 5S. X... X.... D0 0 0Sample OutputnoyesAuthorzhang, ZhengSourceZJCPC2004Initi
;'S ': the start point of the doggie;'D': the Door; or'.': An empty block.
The input is terminated with three 0's. This test case is not to be processed.
OutputFor each test case, print in one line "YES" if the doggie can have ve, or "NO" otherwise.
Sample Input4 4 5S.X.. X... XD....3 4 5S.X.. X.... D0 0 0
Sample OutputNOYES analysis:
This question is to give your start point S, end point D, and ask if you can reach the end point D at T moment.Analysis: this is obviously a DFS, but it involve
Hdu1010 Tempter of the Bone (dfs + parity pruning)
The second time I did this question, I did not read it carefully, and I went straight to BFS. I used to find out if I had escaped the maze in T seconds instead of T seconds;
When I was just learning to search, I was not impressed enough. I forgot about parity pruning, so I was writing a blog;
First, we will introduce the parity
UV 10318-security panel DFS pruning
ACM
Address: Ultraviolet A 10318-security panel
Question:This is similar to the lighting question. When a lamp is selected, the lighting game changes its status and the surrounding lights.However, we have a special on-and-off technique, which provides a location for changing the status, rather than changing around the clock.Ask the minimum switch step from shutting down all to turning on all.
Analysis:Obviously, it
Case:At some point, we want to add a function to multiple functions, such as timing statistics, logging, caching results, etc.Requirements:You do not need to add exactly the same code in each functionHow to solve?Pull out the same code and define it as an adorner.The Fibonacci sequence (the Golden section), starting with the 3rd item of the series, each of which equals the sum of the first two.For a total of 10 stairs, from the bottom to the top, one can only take a step at a time, and can not r
1. Chess usually needs to calculate the current situation, each step after the situation points, usually we can set the consideration of a few moves, usually we call the calculation of chess, and the computer's AI algorithm is most commonly used is the maximum minimum value algorithm, and pruning algorithm is a maximum value of the minimum algorithm optimization.As shown in the following:1. If in the current situation, assume that there are three step
SCU-4497
Given a n*n puzzle, ask to rearrangeMakes a block that is adjacent to each other on the same number of squares connected
It's rather disgusting.I've just begun to move in the set by saving each line of work, and the result is a mle.Later, a different idea, snake to find a block to connectAnd then tried a few pruning, the effect is not idealGenerate several sets of random data yourselffound that when the numbers are 0~3, compared
Ask for a minimum bandwidth arrangement and minimum bandwidth. Bandwidth is the maximum distance from a letter to its adjacent letter.Topic Analysis: In the process of recursive generation of the whole arrangement of pruning, pruning scheme is still two. First, the current solution is inferior to the optimal optimization, minus; second, the prediction of the ideal solution does not need to optimize the opti
The main topic: with n length may not be equal to match the maximum number of sticks.Title Analysis: Enumerate the lengths of all possible equal-length sticks, match each root by DFS, and prune them in the process. The length of the stick is sorted from large to small, that is to say, it is always preferred to match each long stick. The pruning scheme is as follows: 1. If the i-1 stick is not used in the matching of the current scheme and length[i]==l
is a violent, and the eight Queen is very similar, but still need to add some pruning.1. The most naked mob search6.420s, almost timed out2. There is no need to leave the position before, each time from the position of the last put0.400s#include #includeConst intMAXN = One;CharG[MAXN][MAXN];intMaxd;intn,m;BOOLvisi[maxn],visj[maxn],vis1[maxn1],vis2[maxn1];BOOLDfsintDintSiintSJ) { if(d = =Maxd) { for(inti =0; I ) for(intj =0; J ){
The minimum number of questions required by the multiplication method is actually an array beginning with only one number: 1, each time you can take two numbers from the array (you can take the same number) to add a new number plus an array.So obviously this is an iterative deepened search, from small to large enumeration depth caps.In order to reduce the complexity of the time, we want to reduce the number of iterations, so we give priority to the addition, and priority to add the largest numbe
cases. The first line of all test case contains three integers n, m, and T (1 ' X ': a block of wall, which the doggie cannot enter;' S ': The start point of the doggie;' D ': the Door; Or'. ': an empty block.The input is terminated with three 0 ' s. This test is a not-to-be processed.Outputfor each test case, print on one line "YES" if the doggie can survive, or "NO" otherwise.Sample Input4 4 5S. X... X... Xd.... 3 4 5S. X... X.... D0 0 0Sample OutputNOYESAuthorzhang, ZhengSourceZJCPC2004recom
ZOJ problem Set-1136MultipleTime Limit:10 Seconds Memory limit:32768 KBA program that, given a natural number N between 0 and 4999 (inclusively), and M distinct decimal digits x1,x2. XM (at least one), finds the smallest strictly positive multiple of N there is no other digits besides x1,x2. XM (if such a multiple exists).The input file has several data sets separated by a empty line, and each data set has the following format:On the first line-the number NOn the second line-the number MOn the f
first line of input contains a number of nodes N (2 Output file must contain a single integer-the maximum traffic between the subnetworks.OutputOutput must contain a single integer-the maximum traffic between the subnetworks.Sample Input30 50 3050 0 4030 40 0Sample Output90Test instructions: Divides a given graph into two sub-graphs, a, a, a, and the maximum of the distance and max of node J in node I to B, and the maximum output valueAt first glance thought is the diagram thesis, originally ca
the Lattice + return false; - } the intMain () * { $ intT,i,j;//x is a row and Y is a column. Panax Notoginseng stringtemp="", tem="XXXXXXXX"; - while(SCANF (" %d%d%d", n,m,t) n!=0) the { + V.push_back (TEM); A for(i=0; i) the { +Cin>>temp; -temp='X'+temp; $temp+='X';//surround it. $ V.push_back (temp); - if(Temp.find ('S')!=-1) - { thex_1=i+1; Y_1=temp.find ('S'); - }Wuyi if(Temp.find ('D')!=-1) the
Knapsack problem, because the data is not easy DP, instead of pruning, first by cost-effective sorting, if the rest of the backpack space at the highest cost-effective selection will not be better than the best solution has been found pruning, that isif (val + (LD) Pk[d].val/(LD) PK[D].W * (lim-w) + EPS Return}I didn't think so, 0ms.#include HDU5887 Herbs Gathering (search
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.