上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 50 下一页
摘要: problem给定字符串A,B。求串A中可以分割出多少个互不相同的串B(不能重叠)。solution模板题,没啥好说的。 KMP匹配:如果成功,就把j==0,从头开始匹配,答案累加。codes#include#include#includeusing nam... 阅读全文
posted @ 2018-08-10 20:19 gwj1139177410 阅读(118) 评论(0) 推荐(0) 编辑
摘要: problem模拟操作系统的进程调度给定每一个进程的进程号,到达时间,执行时间和运行优先级。(已经按到达时间从小到大排序)如果一个进程到达的时候CPU是空闲的,则它会一直占用CPU直到该进程结束。除非在这个过程中,有一个比它优先级高的进程要运行。如果一个进程... 阅读全文
posted @ 2018-08-10 14:25 gwj1139177410 阅读(173) 评论(0) 推荐(0) 编辑
摘要: problem两个长为n的序列A,B。保证AB已升序排序。在AB中各任取一个值相加得到N^2 个数。求其中最小的N个数n #include#includeusing namespace std;const int maxn = 1e5+10;int n, a... 阅读全文
posted @ 2018-08-10 12:20 gwj1139177410 阅读(116) 评论(0) 推荐(0) 编辑
摘要: problem给定n个二次函数(ai,bi,ci > 0)求前m小的fi(x)值,x>0n, m #includeusing namespace std;const int maxn = 1e4+5;struct func{int a, b, c;}f[ma... 阅读全文
posted @ 2018-08-10 11:48 gwj1139177410 阅读(142) 评论(0) 推荐(0) 编辑
摘要: problem给定n个整数,在其中任意选出两个进行xor运算,得到的结果最大值是多少?nusing namespace std;const int maxn = 1e5+10;int tot, tire[maxn*32][2];void insert(int... 阅读全文
posted @ 2018-08-10 11:05 gwj1139177410 阅读(146) 评论(0) 推荐(0) 编辑
摘要: problem给定n个长度不超过10的数字串(n#include#includeusing namespace std;const int maxn = 1e5+10;int tire[maxn][26], val[maxn], tot;void build... 阅读全文
posted @ 2018-08-10 10:32 gwj1139177410 阅读(151) 评论(0) 推荐(0) 编辑
摘要: problem维护一个集合,支持以下两种操作 1. 加入一个字符串s 2. 查询集合中是否存在字符串ssolution维护一个哈希表,判断字符串是否已出现过。codes#include#include#includeusing namespace std;c... 阅读全文
posted @ 2018-08-09 16:49 gwj1139177410 阅读(176) 评论(0) 推荐(0) 编辑
摘要: problem有n片雪花,每片有6个脚,每个脚有一个长度。两片雪花是一样的当且仅当每个脚的长度顺序都一样(顺逆时针和开始位置不管)求n片雪花中是否有一样的雪花。solution维护一个哈希表定义Hash(a1,a2,..a6) = (sum(a1..a6)+... 阅读全文
posted @ 2018-08-09 15:56 gwj1139177410 阅读(123) 评论(0) 推荐(0) 编辑
摘要: problem给定两个字符串s1,s2,求s1在s2中出现了多少次(可重叠)。len(s1) #include#includeusing namespace std;typedef long long LL;const int maxn = 1e6+10, ... 阅读全文
posted @ 2018-08-09 13:53 gwj1139177410 阅读(181) 评论(0) 推荐(0) 编辑
摘要: problem给一个字符串,长度不超过 1e6,有两种操作:在第 i 个字符的前面添加一个字符 ch查询第 k 个位置是什么字符操作的总数不超过 2000solution1、传统的数组所有数据在内存中是紧凑储存的,优点是定位快:O(1),缺点是修改慢:O(n... 阅读全文
posted @ 2018-08-09 13:03 gwj1139177410 阅读(277) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 50 下一页
选择