摘要: 基本思想: 被递归搞怕了,其实循环打表都可以,提前打表复杂度更低一点; 关键点: 无; #include<iostream> #include<vector> using namespace std; const int maxn = 31; int num[maxn]; void init() { 阅读全文
posted @ 2020-03-09 14:24 暮云林凌 阅读(115) 评论(0) 推荐(0)
摘要: 基本思想: 无; 关键点: 无; #include<iostream> #include<vector> using namespace std; const int maxn = 1000000010; int cnt; void fun(int index,int n) { if (index 阅读全文
posted @ 2020-03-09 14:15 暮云林凌 阅读(189) 评论(0) 推荐(0)
摘要: 基本思想: 还是在注意一下,最大公因数和质因子没啥关系,最大公因数可以是合数; 最大公因数求法:辗转相除; 最小公倍数求法:m*n/最大公因数; 关键点: 无; #include<string> #include<iostream> #include<vector> using namespace 阅读全文
posted @ 2020-03-09 14:06 暮云林凌 阅读(192) 评论(0) 推荐(0)
摘要: 基本思想: 快速幂取模,如果不去模,就是快速幂大数问题; 关键点: 无; #include<iostream> #include<string> using namespace std; typedef long long ll; string s; //int f[maxn]; void mult 阅读全文
posted @ 2020-03-09 12:54 暮云林凌 阅读(190) 评论(0) 推荐(0)
摘要: 基本思想: 自己想用dfs方式来进行遍历,但是发现找不到剪枝的方向,只能确定边界,状态无序; 如果采用递归的方法,可以进行问题分解; 本质上就是n个有序圆盘,相当于分解为以下几步: 1.将n-1个有序圆盘原封不动移到第三根杆子处; 2.将第n个最大盘子移到第二位; 3.把n-1个有序圆盘原封不动移回 阅读全文
posted @ 2020-03-09 12:02 暮云林凌 阅读(269) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-03-09 02:05 暮云林凌 阅读(276) 评论(0) 推荐(0)
摘要: 基本思想: 老生常谈的问题,这种阶乘主要考察溢出。 用大数、long long、double可以解决; 关键点: 无; #include<iostream> #include<vector> #include<string> #include<algorithm> using namespace s 阅读全文
posted @ 2020-03-09 02:00 暮云林凌 阅读(265) 评论(0) 推荐(0)
摘要: 基本思想: 崩溃了,主要还是有两个问题: 1.存在剪枝问题,不剪枝会超时; 2.DFS写法的问题,感觉OJ里特别喜欢通过返回true false,来进行多循环的一次递归解决所有问题; bool dfs(int n,int index,int value,int num) { if (num == 3 阅读全文
posted @ 2020-03-09 00:56 暮云林凌 阅读(145) 评论(0) 推荐(0)