摘要: 题面: There are n courses in the course selection system of Marjar University. The i-th course is described by two values: happiness Hi and credit Ci. I 阅读全文
posted @ 2020-04-05 21:29 IrIrIrllleaf 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 字典树是一种树型结构,可用于较高效的处理字符串前缀相关问题,实际应用和搜索引擎密切相关。 此图即为字典树,根节点不存储字符,每个根节点有26(52)颗子树。 建树代码: const int maxn = 1e6 + 5; int v[maxn],tree[maxn][26]; //tree里存每个节 阅读全文
posted @ 2020-04-02 20:51 IrIrIrllleaf 阅读(247) 评论(0) 推荐(0) 编辑
摘要: owowowow欧拉筛可以作为一种素数筛,相比埃氏筛来讲性能更加优越 埃氏筛的时间复杂度是O(nloglogn),而欧拉筛是线性复杂度。 代码: 1 const int maxn = 1e8 + 5; 2 bool isprime[maxn]; 3 int prime[maxn], psz; 4 i 阅读全文
posted @ 2020-04-01 22:14 IrIrIrllleaf 阅读(247) 评论(0) 推荐(0) 编辑