Pots
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 10149
Accepted: 4275
Special Judge
DescriptionYou are given the pots of the volume of A and B liters respectively. The following operations can be performed:
Fill (i) Fill the pot i (1≤ i ≤ 2) from the tap;
DROP (i) empty the pot I to the drain;
Pour (i,
Descriptionyou is given the pots, having the volume of A and B liters respectively. The following operations can be Performed:fill (i) FILL the pot I (1≤i≤2) fromThe tap;drop (i) empty the pot I to the drain; Pour (i,j) pour fromPot I to pot J; After ThisOperation either the pot J isFull (and there is some water leftinchThe pot i), or the pot I isempty (and all its contents has been moved to the pot J). Write a program to find the shortest possible se
Pots
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 9963
Accepted: 4179
Special Judge
DescriptionYou are given the pots of the volume of A and B liters respectively. The following operations can be performed:
Fill (i) Fill the pot i (1≤ i ≤ 2) from the tap;
DROP (i) empty the pot I to the drain;
Pour (i,j
Pots
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 12198
Accepted: 5147
Special Judge
DescriptionYou are given the pots of the volume of A and B liters respectively. The following operations can be performed:
Fill (i) Fill the pot i (1≤ i ≤ 2) from the tap;
DROP (i) empty the pot I to the drain;
Pour (i,
Pots
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 11705
Accepted: 4956
Special Judge
DescriptionYou are given the pots of the volume of A and B liters respectively. The following operations can be performed:
Fill (i) Fill the pot i (1≤ i ≤ 2) from the tap;
DROP (i) empty the pot I to the drain;
Pour (i,
Pots
Time limit:1000 ms
Memory limit:65536 K
Total submissions:9963
Accepted:4179
Special Judge
Description You are given two pots, having the volumeAAndBLiters respectively. The following operations can be saved med:
Fill (I) fill the potI(1 ≤I≤ 2) from the tap;
Drop (I) Empty the potITo the drain;
Pour (I, j)
Pots
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 10255
Accepted: 4333
Special Judge
DescriptionYou are given the pots of the volume of A and B liters respectively. The following operations can be performed:
Fill (i) Fill the pot i (1≤ i ≤ 2) from the tap;
DROP (i) empty the pot I to the drain;
Pour (i,
Description
You are are given two pots, having the volume of A and B liters respectively. The following operations can be Performed:fill (i) FILL the pot I (1≤i≤2) from the tap; DROP (i) empty the pot I to the drain; Pour (i,j) pour from pot I to pot J; After this operation either the pot J are full (and there may to some water left in the pot I), or the pot I is empty (and All its contents have been moved to the pot J).
Write a program to find the s
Pouring Water.
Give two cups A and B respectively. By connecting the water from the tap (each time it is filled with water), all the water in the cup is dumped, and the water in one cup is poured into the other three operations to make the water in one cup C.
Solution: 6-entry BFs. The difficulty lies in how to save the path.
#include
Poj3414 pots (BFS)
Tags: poj BFS
Link: poj 3414
Question: The capacity of two bottles a, B, and a target water volume C are given. You can perform the following operations on A and B:
Fill (I) fills the bottle with water
Drop (I) Empty the bottle I
Pour (I, j) pour the water in bottle I into bottle J. After this operation, either the bottle J is filled with water or the bottle I is empty
Perform at least several operations to make the water in A or B Package C and output the specific operation.
Analysis: BFS can b
-abbreviation-First letter abbreviation-Address-Text Direction--Long references-Short cited terms-citations, citations-Defining items tagsDefinition and Usage: tags indicate abbreviations or abbreviations, such as "WWW" or "NATO".By tagging
The number of recursive abbreviations is as follows:
Recursive abbreviation is an abbreviation that recursively references itself in the full name. Because it is recursive, it cannot be accurately interpreted. The earliest example may be visa: Visa
Title Link: http://poj.org/problem?id=3414
Idea: Very simple, is the search can, just a cup of water in the state transfer when the code is a bit less good to write.
Code:
#include #include #include #include #include #include #include
Question;How to load water to C using only two containersAnalysis:BFS questions, but to record the path, referAlgorithmIntroduction to the BFS algorithm (I refer to other people'sProgram).Here is a brief summary: seeCodeText in
# Include # Include
Topic links
POJ3414 Topic
Two bottles 1th and 2nd were given the capacity of A and b respectively, and a target water C, the following operations on two bottles:Fill (i): Fill the bottle IDrop (i): Pour the bottle I into the lightPour (i,j): Pour
This reminds me of the three Coke cans of hangdian. It seems that only the number of output times is enough, and all the paths need to be output here, in this way, BFs alone will have a lot of space redundancy in the state of retention. Therefore,
// The solution for poj1606 is the same, but it should be noted that impossible should be output when there is no solution for this question, and no matter which cup of water capacity meets the requirements, you can output it! # Include # include #
# Include # include # include # include # include # include #include # define bug cout pre! = NULL) {DFS (t-> pre); cout op] k1 = c | CP-> k2 = c) {printf ("% d \ n ", CP-> steps); DFS (CP); Return ;}for (INT I = 0; I k2; break; // a full
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.