摘要: https://www.cnblogs.com/ZnHF 阅读全文
posted @ 2023-07-22 17:02 竹余居居居居居 阅读(16) 评论(0) 推荐(0)
摘要: >>定义 深度优先搜索属于图算法的一种,英文缩写为DFS即Depth First Search.其过程简要来说是对每一个可能的分支路径深入到不能再深入为止,而且每个节点只能访问一次.(according to Baidu) >>几个例子 eg1 1215 迷宫 (求是否有路径) http://ybt 阅读全文
posted @ 2023-07-22 15:11 竹余居居居居居 阅读(60) 评论(1) 推荐(1)
摘要: 1212LETTERS http://ybt.ssoier.cn:8088/problem_show.php?pid=1212 #include<bits/stdc++.h> using namespace std; int maxs=0; bool a[25][25],b[10005]; char 阅读全文
posted @ 2023-07-22 11:03 竹余居居居居居 阅读(23) 评论(0) 推荐(0)
摘要: 1316 #include<bits/stdc++.h> using namespace std; int n; int s=0; void ss(int t){ s+=t/2; for(int m=1; m<=t/2; m++){ ss(m); } } int main(){ cin>>n; ss 阅读全文
posted @ 2023-07-21 16:21 竹余居居居居居 阅读(14) 评论(0) 推荐(0)
摘要: 深搜介绍:https://blog.csdn.net/WillHou/article/details/125487657 记忆化搜索:https://blog.csdn.net/weixin_38889219/article/details/116275418 https://oi-wiki.org 阅读全文
posted @ 2023-07-21 16:11 竹余居居居居居 阅读(20) 评论(0) 推荐(0)
摘要: 优化 原因:有重复计算 解决方案:用数组记录下一些会重复用到的数据,方便直接调用 eg(虽然此题不适用) long long pell(int m){ if(m==1){ return 1; }else if(m==2){ return 2; }else if(a[m]!=0)//判断是否算过 { 阅读全文
posted @ 2023-07-21 15:21 竹余居居居居居 阅读(64) 评论(0) 推荐(0)
摘要: ·递归的特点是函数调用它自己本身。其中直接调用自己称为直接递归,而将a调用b,b又调用a的递归叫间接递归。 eg1 1201:菲波那契数列菲波那契数列是指这样的数列: 数列的第一个和第二个数都为1,接下来每个数都等于前面2个数之和。给出一个正整数a,要求菲波那契数列中第a个数是多少。 #includ 阅读全文
posted @ 2023-07-21 14:08 竹余居居居居居 阅读(82) 评论(0) 推荐(0)
摘要: 1315 #include<bits/stdc++.h> using namespace std; long long f(long long n,long long k){ if(n<k || k==0){ return 0; }else if(n==k){ return 1; }else if( 阅读全文
posted @ 2023-07-21 14:07 竹余居居居居居 阅读(16) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> using namespace std; int t,m,w[105],v[105],f[105][1005]; int main() { cin>>t>>m; for(int i=1; i<=m; i++) cin>>w[i]>>v[i]; for( 阅读全文
posted @ 2023-07-21 09:12 竹余居居居居居 阅读(14) 评论(0) 推荐(0)