Pots 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 pot i …
题目: http://poj.org/problem?id=3414 很好玩的一个题.关键是又16ms 1A了,没有debug的日子才是好日子.. #include <stdio.h> #include <string.h> #include <queue> #include <algorithm> #include <stack> using namespace std; int a, b, c; ][]; enum Ways{FILL_A,…
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…
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: 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…
#include<iostream> #include<cstring> #define fillA 1 #define pourAB 2 #define dropA 3 #define fillB 4 #define pourBA 5 #define dropB 6 #define N 10000 using namespace std; ][]; class node { public: int A, B; int dir; node() { A=; B=; } }; int…
题意: 给你两个空瓶子,只有三种操作 一.把一个瓶子灌满 二.把一个瓶子清空 三.把一个瓶子里面的水灌到另一个瓶子里面去(倒满之后要是还存在水那就依然在那个瓶子里面,或者被灌的瓶子有可能没满) 思路:BFS,打印路径时需技巧. //G++ 840K 0MS #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <stack> #in…
//yy:昨天看着这题突然有点懵,不知道怎么记录路径,然后交给房教了,,,然后默默去写另一个bfs,想清楚思路后花了半小时写了120+行的代码然后出现奇葩的CE,看完FAQ改了之后又WA了.然后第一次用对拍去找特殊数据折腾到十二点半终于AC,最后只想感叹没有仔细读题,没办法啊看着英语略烦躁,不扯了,那个题题解不想写了,回到这题...今天中午还是花了四十分钟写了这题(好慢啊orz),感觉,啊为什么别人可以一下子就写出来,我却想不到怎么写呢!!! poj 3414 Pots  [BFS] 题意:两个…
题目传送门 /* BFS:六种情况讨论一下,BFS轻松解决 起初我看有人用DFS,我写了一遍,TLE..还是用BFS,结果特判时出错,逗了好长时间 看别人的代码简直是受罪,还好自己终于发现自己代码的小错误:) */ /************************************************ Author :Running_Time Created Time :2015-8-3 14:17:24 File Name :POJ_3414_BFS.cpp ***********…
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)…