
算法
nihao_pcm
https://github.com/pengchengming
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
DFS和BFS模板
DFS模板:向深处搜索,直到找到解或者走不下去。这一般解决全排列问题 Void DFS(deep,...){ if(找到解 || 走不下去了){ ......//根据题意添加 return; } for(扩展方式){ if(扩展方式所能达到的状态合法){ 修改操作;//根据题意添加 标记; DFS(deep+1,...); ...原创 2019-04-21 14:41:09 · 1294 阅读 · 0 评论 -
DFS 着色最少颜色
给一个图,相邻的结点关系已给出,求给图着色最少要多少种颜色。 #include <stdio.h> #include <iostream> using namespace std; int t; int count=0; int arr[20][20]; int color[20]={0}; bool judge(int x){ for(int j=1;...原创 2019-04-22 00:01:21 · 631 阅读 · 0 评论 -
HDU 1045 Fire Net DFS题目
Problem Description Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall. A blockhouse...原创 2019-04-24 00:39:04 · 260 阅读 · 0 评论