![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构算法
文章平均质量分 53
yuanba_xs
分享程序员的体会与知识
展开
-
百练1007DNA排序
#include #include #include #include #define N 55 #define M 105 using namespace std; typedef struct dna { char str[N]; int num;//逆序对个数 }DNA; DNA a[M]; int n, m; int count_(char s[])/原创 2017-01-19 19:43:01 · 272 阅读 · 0 评论 -
百练2790:迷宫
#include #include #define N 105 using namespace std; char map[N][N]; int vis[N][N]; int n; int sx, sy, ex, ey; int flag;//记录是否可达 int dx[4] = { -1,0,0,1 }; int dy[4] = { 0,-1,1,0 }; void d原创 2017-01-19 22:03:51 · 435 阅读 · 0 评论 -
hdu1175连连看
/* 连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。 如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次, 那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的, 但事实上这是错的。现在已经酿成大祸,就只能将错就错了,连线不能从外围原创 2017-01-29 18:03:15 · 256 阅读 · 0 评论 -
百练2251:Dungeon Master
/* 三维bfs,三维数组维度从高到低为z,y,x */ #include #include #include #define N 35 using namespace std; typedef struct node { int x, y, z; int step; }point; int l, r, c; char map[N][N][N]; int vi原创 2017-01-19 19:40:41 · 222 阅读 · 0 评论 -
求数的全排列
/*题目:求数的全排列。用dfs方法。转化为dfs模型:手中有n张牌,分别为1~n,面前有n个箱子, 输出所有的放法。 */ #include #include #define N 10 using namespace std; int n; int vis[N] = { 0 }, a[N] = { 0 };//数组vis标记该箱子是否已有纸牌,a存储每个箱子对应的纸牌的数值。 voi原创 2017-01-31 13:21:04 · 292 阅读 · 0 评论