POJ3414 Pots】的更多相关文章

http://poj.org/problem?id=3414                                       Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9996   Accepted: 4198   Special Judge Description You are given two pots, having the volume of A and B liters respe…
Description You 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…
Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10042   Accepted: 4221   Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i)        f…
Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12198   Accepted: 5147   Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i)        f…
题目链接:http://poj.org/problem?id=3414 Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18550   Accepted: 7843   Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operation…
题意:通过题目给出的三种操作,让任意一个杯子中的水到达一定量 分析:两个杯子最大容量是100,所以开个100*100的数组记录状态,最多1w个状态,所以复杂度很低,然后记录一下路径就好 注:代码写残了,我也不会写好看的那种,罪过罪过..QAQ #include<cstdio> #include<algorithm> #include<iostream> #include<cstring> #include<cmath> #include<m…
这道题做了很长时间,一开始上课的时候手写代码,所以想到了很多细节,但是创客手打代码的时候由于疏忽又未将pair赋初值,导致一直输出错误,以后自己写代码可以专心一点,可能会在宿舍图书馆或者Myhome,创客晚上好吵呀,隔壁真的服... 本题大意:给定两个杯子的容量,有六种操作,通过操作使得两个被子其中一个杯子的水等于待输入值C,并输出最少操作次数和操作名称. 本题思路:BFS,遇到合适的直接输出,搜完都没有搜到就impossible. 参考代码: 将switch改为if能节省大部分篇幅,但是swi…
题目链接 http://poj.org/problem?id=3414 题意 有两个杯子,容量分别为A升,B升,可以向杯子里倒满水,将杯子里的水倒空,将一个杯子里的水倒到另一个杯子里,求怎样倒才能使其中的一个杯子里的水恰为C升,输出最少步数和操作:如果不能倒到C升,输出“impossible”. 思路 这题与poj1606基本相同,在poj1606的基础上添加了输出最少步数,修改了操作的表示,以及不可能达到目标时输出impossible.将poj1606的代码略作修改即可. 代码 #includ…
题目: 给你两个容器,分别能装下A升水和B升水,并且可以进行以下操作 FILL(i)        将第i个容器从水龙头里装满(1 ≤ i ≤ 2); DROP(i)        将第i个容器抽干 POUR(i,j)      将第i个容器里的水倒入第j个容器(这次操作结束后产生两种结果,一是第j个容器倒满并且第i个容器依旧有剩余,二是第i个容器里的水全部倒入j中,第i个容器为空) 现在要求你写一个程序,来找出能使其中任何一个容器里的水恰好有C升,找出最少操作数并给出操作过程 输入: 有且只有…
[poj3414]Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16925   Accepted: 7168   Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i)…
Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7783   Accepted: 3261   Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i)        fi…
题目链接 http://poj.org/problem?id=1606 题意 有两个容量分别为ca,cb的杯子,可以向杯子里倒水,将杯子里的水倒空,将一个杯子里的水倒到另一个杯子里,求怎样倒才能使其中的一个杯子里的水恰为N加仑. 思路 两个杯子里的水量组成一个状态,不断地进行题中的6种操作来扩展状态结点进行bfs,直到其中一个杯子的水量为N即可. 代码 #include <iostream> #include <cstdio> #include <cstring> #i…
图论 图论解题报告索引 DFS poj1321 - 棋盘问题 poj1416 - Shredding Company poj2676 - Sudoku poj2488 - A Knight's Journey poj1724 - ROADS(邻接表+DFS) BFS poj3278 - Catch That Cow(空间BFS) poj2251 - Dungeon Master(空间BFS) poj3414 - Pots poj1915 - Knight Moves poj3126 - Prim…
本题传送门 本题知识点:宽度优先搜素 + 字符串 题意很简单,如何把用两个杯子,装够到第三个杯子的水. 操作有六种,这样就可以当作是bfs的搜索方向了 // FILL(1) 把第一个杯子装满 // FILL(2) 把第二个杯子装满 // POUR(1,2) 把第一个杯子的水倒进第二个杯子 // POUR(2,1) 把第二个杯子的水倒进第一个杯子 // DROP(1) 把第一个杯子的水都倒掉 // DROP(2) 把第二个杯子的水都倒掉 本题的难点是如何记录路径,我们可以用一个巧妙的方法去解决掉,…
题意:有两个有着固定容量的茶壶,初始时都为空,要求用FILL,POUR,DROP三种操作来准确地得到C值,输出最少次数及操作方案. 思路:比赛的时候真是脑子不好使,根本没想到是搜索,看了别人的题解用搜索,恍然大悟. 以两茶壶均为空为初始状态,每次对六种操作进行枚举,BFS加记录路径即可. 代码如下: #include<cstdio> #include<queue> #include<vector> using namespace std; struct water{ ]…
Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13545   Accepted: 5717   Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i)        f…
Pots 直接上中文 Descriptions: 给你两个容器,分别能装下A升水和B升水,并且可以进行以下操作 FILL(i)        将第i个容器从水龙头里装满(1 ≤ i ≤ 2); DROP(i)        将第i个容器抽干 POUR(i,j)      将第i个容器里的水倒入第j个容器(这次操作结束后产生两种结果,一是第j个容器倒满并且第i个容器依旧有剩余,二是第i个容器里的水全部倒入j中,第i个容器为空) 现在要求你写一个程序,来找出能使其中任何一个容器里的水恰好有C升,找出…
Pots Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3414 Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i)…
POJ 3414 Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13547   Accepted: 5718   Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i)…
Pots Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11885 Accepted: 5025 Special Judge Description You 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…
问题描述: Pots of gold game: Two players A & B. There are pots of gold arranged in a line, each containing some gold coins (the players can see how many coins are there in each gold pot - perfect information). They get alternating turns in which the play…
Description You 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 ( ≤ i ≤ ) from the tap; DROP(i) empty the pot i to the drain; POUR(i,j) pour from pot i to pot j;…
链接: http://poj.org/problem?id=3414 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22009#problem/J Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8253   Accepted: 3499   Special Judge Description You are given two pots, havin…
poj3414:http://poj.org/problem?id=3414 题意:给你两个罐子的体积,然后让你只用这两个罐子量出给定k体积的水.题解:这里可以把两个罐子看成是一个二维的图,然后体积的水就是图中其中一个坐标是k的点.可以直接BFS,每次操作就相当于从当前的点向外扩展,并且记录当前的路径,即可.其中可以用1,2,3,4,5,6六个数字来分别对应六种操作,然后用一个int类型的数组记录路径就可以. #include<cstring> #include<cstdio> #…
Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8266   Accepted: 3507   Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i)        fill th…
Description You 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…
Pots Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10071   Accepted: 4237   Special Judge Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i)        f…
<span style="color:#330099;">/* D - D Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3414 Description You are given two pots, having the volume of A and B liters respectively. The follow…
Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Description You 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…
Pots Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submission(s) : 31   Accepted Submission(s) : 14 Special Judge Problem Description You are given two pots, having the volume of A and B liters respectively.…