![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DFS
wonderabd
这个作者很懒,什么都没留下…
展开
-
[LeetCode]39. 组合总和
直接写了个搜索。 (效率应该不怎么样……) 39. 组合总和 class Solution { public: vector<int> temp; vector<vector<int>> ans; int tip; int num[100005]; void solve(int x,int tot){ //...原创 2019-04-16 21:45:04 · 89 阅读 · 0 评论 -
[LeetCode]40. 组合总和 II
40. 组合总和 II 解集不能包含重复的组合 每个数字在每个组合中只能使用一次 处理方法:排序后将数组num[i]转化为nums[i]+cont[i],cont[i]表示这个数在原数组中出现了多少次 class Solution { public: int num[100005]; int help[100005]; int nums[100005]; int...原创 2019-04-17 17:18:53 · 80 阅读 · 0 评论 -
[LeetCode]200. 岛屿的个数
18年蓝桥杯省赛出过类似的(难度好像稍微大一点点)…… 200. 岛屿的个数 class Solution { public: const int movex[4]={-1,1,0,0}; const int movey[4]={0,0,1,-1}; int m,n; int num[1005][1005]; bool used[1005][1005]; ...原创 2019-04-20 11:12:47 · 135 阅读 · 0 评论 -
[LeetCode]216. 组合总和 III
216. 组合总和 III class Solution { public: vector<vector<int>> ans; vector<int> temp; int tip; void solve(int x,int y,int tot){ if (tot==0 && x>tip){ ...原创 2019-05-07 16:27:17 · 111 阅读 · 0 评论