首页 > TAG信息列表 > jugs

POJ1606 Jugs

解法一:\(BFS\) 每次扩展的状态有\(6\)个。宽搜多写写还是有好处的。 const int N=110; struct Node { int ca,cb; int dist; string path; }; bool vis[N][N]; string op[]={"FILL(1)","FILL(2)","DROP(1)","DROP(2)","POUR(1,2)",

LeetCode-365 Water and Jug Problem

题目描述 You are given two jugs with capacities xand y litres. There is an infinite amount of water supply available. You need to determine whether it is possible to measure exactly z litres using these two jugs. If z liters of water is measurable, you

BFS——《算法笔记》8.2小节 问题 A: Jugs

首先,我的代码过了样例,但OJ上并没有过(只过了50%),并且神奇的是该题提交记录里没一个人过的(不知道是不是题目的问题)    下面是我的代码,用BFS解决,找出最优路径: #include<iostream> #include<queue> #include<string> #include<string.h> using namespace std; struct node {