![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
回溯
big up
这个作者很懒,什么都没留下…
展开
-
uva529
题目: An addition chain for n is an integer sequence <a0,a1,a2,…,am><a_0, a_1, a_2, \dots, a_m> with the following four properties: a0 = 1 am = n a0#include <iostream> // 迭代深搜 using namespace std; #原创 2015-12-14 19:27:04 · 309 阅读 · 0 评论 -
uva11210
题目大意: 求出所有可以听的牌思路: 暴力枚举,回溯代码:#include <iostream> using namespace std; #include <cstring> #include <stdio.h> const char *mj[] = { "1T", "2T", "3T", "4T", "5T", "6T", "7T", "8T", "9T", "1S", "原创 2016-01-22 15:34:07 · 491 阅读 · 0 评论 -
LA3621(dfs)
题目大意: 已知n,求x最少经过多少次的乘除法可以使得达到x ^n思路: 因为可以乘除,所以要进行回溯 dfs 用一个num表示当前步数 用step表示最多多少步代码:#include <iostream> using namespace std; #include <cstring> #include <algorithm> #include <stdio.h>const int MAX原创 2016-03-17 21:02:43 · 386 阅读 · 1 评论