摘要:
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)
摘要:
·递归的特点是函数调用它自己本身。其中直接调用自己称为直接递归,而将a调用b,b又调用a的递归叫间接递归。 eg1 1201:菲波那契数列菲波那契数列是指这样的数列: 数列的第一个和第二个数都为1,接下来每个数都等于前面2个数之和。给出一个正整数a,要求菲波那契数列中第a个数是多少。 #includ 阅读全文
posted @ 2023-07-21 10:45
竹余居居居居居
阅读(28)
评论(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)

浙公网安备 33010602011771号