回溯
code&day
sdfsdffsdf
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj 2258
题意:求n个节点的无向图中的最长路径。 回溯法+dfs 这题的回溯法的边界条件需要用一个flag来判读。 第10行的错误,我忽视了for里条件不满足就退出,以为可以跳过去。#include <cstdio>#include<iostream>#include<cstring>using namespace std;int s[25][25];...原创 2018-03-09 18:10:56 · 308 阅读 · 0 评论 -
poj 1011
#include<cstdio>#include<algorithm>#include<functional>#include<cstring>#include<iostream>using namespace std;const int maxn=70;int len,used[maxn],s[maxn],n;bool ...原创 2018-03-04 16:39:30 · 180 阅读 · 0 评论 -
poj 1979
poj 1979#include<cstdio>#include<cstring>#include<iostream>using namespace std;char s[30][30];int vis[30][30];int r,c;int ans;void dfs(int x,int y){ if(vis[x][y]||x<0...原创 2018-03-04 18:29:20 · 334 阅读 · 0 评论
分享