![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
dfs
杨小猪猪
这个作者很懒,什么都没留下…
展开
-
AcWing 1072. 树的最长路径
题目链接 题意:求数的最长路径 #include<bits/stdc++.h> using namespace std; const int N=20010; int h[N],w[N],e[N],ne[N],idx=0,ans=0; void add(int a,int b,int c){ e[idx]=b,w[idx]=c,ne[idx]=h[a],h[a]=idx++; } int dfs(int u,int father){ int d1=0,d2=0,dist=0原创 2021-10-13 17:44:05 · 46 阅读 · 0 评论 -
CodeForces - 244B(dfs+剪枝,set)
题目链接 题意:求小于n且最多由2个数组成的数的个数 #include<bits/stdc++.h> using namespace std; set<long long>a; int n, x, y; void dfs(long long num, long long pos) { if (num > n || pos > 10)return; a.insert(num); dfs(num * 10 + x, pos + 1); dfs(num * 10原创 2021-10-10 22:29:40 · 136 阅读 · 0 评论