题解 3035: LETTERS

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

DFS集合set实现

摘要:解题思路: 用集合,记载路径中的字符。结合深度优先搜索实现。注意事项:参考代码://LETTERS 深搜与回溯#include <bits/s……

dfs菜鸟级包能懂

解题思路:dfs直接搜,拿一个数组存一下访问过的数组就行啦,变量名不规范见谅注意事项:参考代码:#includeusingnamespacestd;constintMAX_SIZE=20;charstr[MAX_SIZE][MAX_SIZE];intn,

LETTERS 搜搜搜搜搜搜

摘要:解题思路:注意事项:参考代码:#include"bits/stdc++.h" using namespace std; // 定义全局变量r和s,kkk初始化为-1 int r, s, kkk ……

dfs--字符转数存状态//[LETTERS]

#利用Ascall码性质将字符转为数字存在数组跟新状态######话说unordered_map也有这种性质但是我用他wa了一个点首先看到最多最长类似的字样首先想到的是深搜当然要注意回溯、本题简单就不多啰嗦看代码注释;######Code:```cpp#include#include#include#

[LETTERS] BFS 配合 map容器

##unordered_map的.count函数-用于查找是否出现过该状态,是返回1;```cpp#include#defineULLunsignedlonglong#defineLLlonglong#definePIIpairusingnamespacestd;constintN=1e7+10,

LETTEARS(走路径)

```cpp#includeusingnamespacestd;#defineendl'\n'#defineintlonglongconstintN=25;chara[N][N];intn,m,max_s=0;unordered_mapg;intX[]={0,

LETTERS(经典DFS)

摘要:解题思路:注意事项:参考代码:#include<iostream> #include<cstdio> using namespace std; int r, s,t1=0,t2;//r,s表示迷……

LETTERS:DFS(搜索与回溯)、C++

####注意题目要求不能回到走过的字母,因此注意回溯判断条件有两个关键:其一是越界,其二是标记数组```cppDFS基本模板如下voiddfs(intk,...){if(满足条件)return;for(inti=0;i>r>>s;for(inti=0;i>str[i];fill(