随笔分类 -  +模板库

摘要:思路 题意 : " 题目 " 为中文题,这里不再过多阐述。 思路1 :可以在读入单词表的过程中将单词分解,用map将它一 一记录 思路2 :利用字典树,这个方法较快些,下面代码中会分别给出数组和结构体指针两种形式的字典树,指针形式的有时可能会因题目内存限制而导致Memory Limit Exceed 阅读全文
posted @ 2019-08-17 23:27 DIY-Z 阅读(105) 评论(0) 推荐(0)
摘要:二分 二分算法模板 注意此模板只适用于查找a中是否存在v,存在的话则返回其中一个符合条件的位置,并不一定只有那一个位置,这个视情况而定。 lower_bound lower_bound()在一个区间内进行二分查找,返回第一个大于等于目标值的位置(地址) upper_bound upper_bound 阅读全文
posted @ 2019-08-01 23:00 DIY-Z 阅读(752) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main() { const int maxn = ...; //n的阶乘所得的值的大致位数 int a[maxn];//储存每一位所得到的数 int temp,digit,n,i,j=0;//temp每次的得数 digit每次得数的位数 scanf(" 阅读全文
posted @ 2019-07-06 23:39 DIY-Z 阅读(261) 评论(0) 推荐(0)
摘要:转载自:https://blog.csdn.net/f_zyj/article/details/51594851 创建自:https://blog.csdn.net/ZDL_0908/article/details/91357779 阅读全文
posted @ 2019-07-06 19:29 DIY-Z 阅读(179) 评论(0) 推荐(0)
摘要:#includeusing namespace std;int main(){ //设想要建立一个rows行,cols列的矩阵 //使用new进行新建 int rows, cols; cin >> rows >> cols; ... 阅读全文
posted @ 2019-05-27 22:03 DIY-Z 阅读(1533) 评论(0) 推荐(0)
摘要:Input Output 22 代码: 阅读全文
posted @ 2019-05-21 20:50 DIY-Z 阅读(250) 评论(0) 推荐(0)
摘要:生成1~n的排列:#includeusing namespace std;void print_permutation(int n, int *A, int cur) /*n代表这个排列中的元素数*/{ if(cur == n) ... 阅读全文
posted @ 2019-05-14 19:38 DIY-Z 阅读(222) 评论(0) 推荐(0)
摘要:ACM算法模板 · 一些常用的算法模板-模板合集(打比赛专用) 阅读全文
posted @ 2019-05-11 11:37 DIY-Z 阅读(416) 评论(0) 推荐(0)
摘要:int ans = 0;void merges(int *a, int lef, int righ){ if(lef == righ) /*边界*/ return ; int mid = lef + (righ -... 阅读全文
posted @ 2019-05-06 21:29 DIY-Z 阅读(354) 评论(0) 推荐(0)