摘要:
http://poj.org/problem?id=3414记录瓶子状态,广度优先搜索即可#include #include #include using namespace std;const int maxn=101;int n,m;typedef unsigned long long ull;... 阅读全文
摘要:
http://poj.org/problem?id=3087设:s1={A1,A2,A3,...Ac}s2={Ac+1,Ac+2,Ac+3,....A2c}则合在一起成为Ac+1,A1,Ac+2,A2......A2c,Ac经过一次转换之后变成s1={Ac+1,A1,Ac+2.....}s2={..... 阅读全文
摘要:
http://poj.org/problem?id=3126搜索的时候注意1:首位不能有02:可以暂时有没有出现在目标数中的数字#include #include #include using namespace std;const int maxn=1e4+5;const int inf=0x7f... 阅读全文
摘要:
http://poj.org/problem?id=1426测试了一番,从1-200的所有值都有long long下的解,所以可以直接用long long 存储从1出发,每次向10*s和10*s+1转移,只存储余数即可,对于余数i,肯定只有第一个余数为i的最有用,只记录这个值即可#include #... 阅读全文
摘要:
http://poj.org/problem?id=3279明显,每一位上只需要是0或者1,遍历第一行的所有取值可能,(1#include #include #include using namespace std;int maz[15][15];int op[15][15];int ans[15]... 阅读全文
摘要:
http://poj.org/problem?id=3278从n出发,向两边转移,为了不使数字无限制扩大,限制在2*k以内,注意不能限制在k以内,否则就缺少不断使用-1得到的一些结果#include #include #include #include using namespace std;con... 阅读全文
摘要:
http://poj.org/problem?id=2251bfs,把两维换成三维,但是30*30*30=9e3的空间时间复杂度仍然足以承受#include #include #include #include using namespace std;struct P{ int x,y... 阅读全文
摘要:
http://poj.org/problem?id=1321注意是在'#'的地方放棋子矩阵大小不过8*8,即使是8!的时间复杂度也足以承受,可以直接dfs求解dfs时标注当前点的行和列已被访问,接着搜索行列都未被访问的新点,注意搜索完毕之后标注当前点的行和列未被访问#include #include... 阅读全文