![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
递归
KageMushaHRo
懒 狗
展开
-
洛谷P1036 选数
P1036 DFS+素数判断 一道简单的dfs题,数据规模也不大,可以直接用普通版素数判断法。 注意dfs去重时采取升序的方法。 话不多说,直接干代码: #define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <cmath> #include <cctype> #include <cstring> #include <string> #include <sstream> #原创 2020-05-19 16:34:48 · 206 阅读 · 0 评论 -
P1028 数的计算
P1028 记忆化dfs或递推 首先,此题如若用普通的递归,肯定是过不了所有点的。所以要么用记忆化要么用递推。 先来一壶记忆化的代码,实现不难: #define _CRT_SECURE_NO_WARNINGS #include <cstdio> #include <cctype> #include <string> #include <sstream> #include <stack> #include <set> #include原创 2020-05-19 14:18:52 · 93 阅读 · 0 评论