摘要:
http://poj.org/problem?id=3414题意:给出1号杯子的容量a,2号杯子的容量b,目标盛水量c。问两个杯子经过怎样的变换能盛出c容量的水,输出最小步数及转换过程,如不能转换,输出“‘impossible”。思路:总共有6种转换,bfs搜索每一种转换,并记录前一个状态。最后将记录的状态倒着输出。 1 #include 2 #include 3 #include 4 #include 5 #include 6 const int N=112; 7 using namespace std; 8 string oper[7] = {"","FILL 阅读全文
posted @ 2013-08-29 00:43
N_ll
阅读(194)
评论(0)
推荐(0)

浙公网安备 33010602011771号