
模板
Merry_hj
不完美小孩的完美梦想
展开
-
筛法
1.原始求素数的方法#include<bits/stdc++.h>using namespace std;int func(int n) { int count = 0; for(int i = 2; i < n; i++) { if(n % i == 0) break; else count++; ...原创 2020-03-19 22:56:32 · 345 阅读 · 0 评论 -
优先队列+记忆化搜索
算法上依然是搜索的流程,但是搜索到的一些解用动态规划的那种思想和模式作一些保存。一般说来,动态规划总要遍历所有的状态,而搜索可以排除一些无效状态。更重要的是搜索还可以剪枝,可能剪去大量不必要的状态,因此在空间开销上往往比动态规划要低很多。记忆化算法在求解的时候还是按着自顶向下的顺序,但是每求解一个状态,就将它的解保存下来,以后再次遇到这个状态的时候,就不必重新求解了。这种方法综合了搜索和动态规划两原创 2017-07-18 19:50:54 · 326 阅读 · 0 评论 -
hdu 2795 Billboard 线段树
Problem Description At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcements a原创 2017-07-23 14:49:05 · 314 阅读 · 0 评论