递归求解
deku_
这个作者很懒,什么都没留下…
展开
-
dfs2 ACM ICPC 2014–2015, Northeastern European Regional Contest
J Jokewithpermutation Joey had saved a permutation of integers from 1 to n in a text file. All the numbers were written as decimal numbers without leading spaces. Then Joe made a practical jo...原创 2018-07-28 23:16:42 · 160 阅读 · 0 评论 -
还是dfs3HDU6333
16*16十六宫格图旋转次数最小让其变成行列都可以满足1-16所有数 #include <iostream> #include <cstdio> #include <cstring> using namespace std; char s[16][16],w[16][16]; int Ans; int vis[16]; void roate(int a,in...原创 2018-08-02 15:31:59 · 230 阅读 · 0 评论 -
记一个找树的重心/dfs
//求树的重心 int rcd[maxn];//记录去掉这个节点最大块的节点数 int dfs(int u,int fa) { int i,v,t1,tmp; for(int i=head[u];i;i=edge[i].nxt) { v=edge[i].to; if(v==fa)continue; t1=dfs(v,u); ...原创 2018-08-12 18:07:48 · 353 阅读 · 0 评论 -
UVALive 8080 又是一道dfs题
#include<bits/stdc++.h> using namespace std; vector <int> a[200000]; int d[200000]; int k; int dfs(int u,int par) { int sum=0; int res[2000]; int cou=0; for(int i=0;i<...原创 2018-08-21 21:13:21 · 131 阅读 · 0 评论 -
Dancing list (两个双向链表构成交叉的图)
#include <iostream> using namespace std; const int maxn=2e5; int L[maxn];//左方向的链表 int R[maxn];//右方向的链表 int U[maxn];//上方向的链表 int D[maxn];//下方向的链表 int C[maxn];//指向列指针头的地址 int S[maxn];//记录列的节点个数 i...原创 2018-11-13 13:23:42 · 498 阅读 · 0 评论