自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

lanshan1111的博客

在最终的结果到来之前,任何肯定会赢之类的话都是虚无缥缈的。

  • 博客(70)
  • 收藏
  • 关注

原创 字典树静态模板

#define MAX 26const int maxnode=4000*100+100;//预计字典树最大节点数目const int sigma_size=26;//每个节点的最多儿子数 struct Trie{ //这里ch用vector<26元素的数组> ch;实现的话,可以做到动态内存 int ch[maxnode][sigma_size];//ch...

2018-12-31 16:53:45 122

原创 TRIE判断前缀码POJ1056 IMMEDIATE DECODABILITY

http://poj.org/problem?id=10561 判断它是不是其他元素的前缀2 判断它的前缀有没有DescriptionAn encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for ano...

2018-12-31 16:52:31 174

原创 字典树最短前缀POJ2001Shortest Prefixes

http://poj.org/problem?id=2001DescriptionA prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", "ca", "car", "carb", "carbo", and

2018-12-31 11:51:35 174 5

原创 周末总结

轻松了两天,接下来要加油了!今天看完字典树例题,明天看AC自动机和后缀数组。

2018-12-31 11:12:09 136

原创 TRIE翻译明暗文HDU1075What Are You Talking About

http://acm.hdu.edu.cn/showproblem.php?pid=1075 Problem Description Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives hi...

2018-12-31 11:09:16 372

原创 TRIE字符串查找HDU1251统计难题

http://acm.hdu.edu.cn/showproblem.php?pid=1251 Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).     Input 输入数据的第一部分是一张单...

2018-12-31 10:51:25 162

原创 周中总结

java考试以题量打败了我们...感觉还是测试一下数据比较好,一些说得含糊其辞的地方很容易让人写错。希望接下来的比较拿手的离散数学考试可以考得高分,不多说了。周六忙完再看算法,周六就结束了主体考试。...

2018-12-27 22:36:08 99

原创 周末训练总结

字典树看完了,下面看一下AC自动机。字典树用到了指针,不太好理解,多做几道题理解一下他的应用。还有就是平常多做一些比赛,不能手生,练一下手感。...

2018-12-23 22:00:15 154 2

原创 牛客小白月赛A 二叉树不要忘记取模

 链接:https://ac.nowcoder.com/acm/contest/280/A来源:牛客网 Actci偶然发现了一个矿洞,这个矿洞的结构类似与一棵二叉树,Actci发现的矿洞恰好位于根节点处,为了尽快挖掘,Actci找来了她的小伙伴们来帮忙,由于地质原因,每天小伙伴们只能打通到一条到子节点的道路(不消耗时间),也就是说每天一个节点只能向一个子节点建设道路,走一条路需要一天的...

2018-12-22 23:52:35 219

原创 牛客小白月赛C 全部公约数

链接:https://ac.nowcoder.com/acm/contest/280/C来源:牛客网 题目描述Actci上课睡了一觉,下课屁颠屁颠的去找数学老师补课,问了老师一个题目:    给出两个数a,b,问a和b的全部公约数是什么?数学老师一看这道题太简单了,不屑回答,于是就交给了你。输入描述:一行两个数a,b.输出描述:a和b的全部公约数,每个数字之间空格...

2018-12-22 23:30:45 191

原创 牛客小白月赛B JAVA大数或String

链接:https://ac.nowcoder.com/acm/contest/280/B来源:牛客网 某年某月某天的数学课上,Actci正在遨游宇宙呢,对于他的屡教不改,她的数学老师决定难为一下Actci,将他叫醒。“咳咳,我现在给出一个数a(0≤a≤1010000),判断a是否是3,5,8,11中某些数的的倍数,你只有一秒钟的时间,答不上来的话,呵,%#W$%@#$@...”。 ...

2018-12-22 23:26:49 135

原创 字典树或mapHDU1251统计难题

http://acm.hdu.edu.cn/showproblem.php?pid=1251 #include <iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>using namespace std;/*****...

2018-12-20 20:27:22 104

原创 周中训练总结

最近在看字典树,数据结构中的kmp和字典树和实际联系很大,要把他们理解好,把题型看一下,注意总结方法。尤其是kmp变化形式多种多样。争取周五之前结束字典树。同时多看一下以前的图论部分典型题,不及时看很快就淡忘。做题还是要细心读题,昨天的练习做一个题最短路改了很多次发现读错题了....这让我想起来考电子一个图忘画了...............感觉这次也就会考的一般般,毕竟不太喜欢冬天,还是夏天...

2018-12-20 10:19:16 112

原创 最小生成树 Maximum Distance

D. Maximum Distancetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputChouti was tired of the tedious homework, so he opened up an o...

2018-12-20 10:03:35 371

原创 POJ 3268Silver Cow Party最短路

http://poj.org/problem?id=3268 Language:Default Silver Cow Party Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 30726   Accepted: 13925 Des...

2018-12-19 21:08:46 152

原创 字典树的插入、查询、前缀查询、模糊查询

package jjd;import java.util.TreeMap;public class Trie { public class Node { private boolean isWord; private TreeMap<Character, Node> next; public Node(boolean isWord) { this.isW...

2018-12-18 10:09:11 563

原创 HUST - 1010KMP最小循环节性质

There is a string A. The length of A is less than 1,000,000. I rewrite it again and again. Then I got a new string: AAAAAA...... Now I cut it from two different position and get a new string B. Then, ...

2018-12-17 23:57:14 163

原创 HDU1385Period

http://acm.hdu.edu.cn/showproblem.php?pid=1358 Problem Description For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we w...

2018-12-17 11:22:57 115 3

原创 HDU3746Cyclic Nacklace 利用next数组补成至少两个循环节

http://acm.hdu.edu.cn/showproblem.php?pid=3746CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left...

2018-12-17 10:34:04 131

原创 HDU1686Oulipo KMP返回串出现的次数

http://acm.hdu.edu.cn/showproblem.php?pid=1686 The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote ...

2018-12-16 23:32:17 150

原创 周末总结

四级六百分的希望破灭了,果然裸考是行不通的。对完答案预计585+,告一段落。六级一定要好好准备,快两年没碰过英语题了,要抽出时间做一些题练练手感。最近打算把kmp题型再看一下,接着看字典树。加油。...

2018-12-16 09:03:37 134

原创 HDU1711KMP模板题返回匹配位置

Problem Description Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K ...

2018-12-16 08:57:41 255

原创 POJ3694加边后桥的数目 LCA+并查集+强联通分量

http://poj.org/problem?id=3694DescriptionA network administrator manages a large network. The network consists of N computers and M links between pairs of computers. Any pair of computers are conn...

2018-12-15 15:09:53 127

原创 UVA 796 - Critical Links (求桥)

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=737In a computer network a link L, which interconnects two servers, is considered critical...

2018-12-14 10:25:29 131

原创 POJ 1144——Network 求割点

https://vjudge.net/problem/20837/origin求割点问题该算法是R.Tarjan发明的。对图深度优先搜索,定义DFS(u)为u在搜索树(以下简称为树)中被遍历到的次序号。定义Low(u)为u或u的子树中能通过非父子边追溯到的最早的节点,即DFS序号最小的节点。根据定义,则有:Low(u)=Min { DFS(u) DFS(v) (u,v)为后向边(返祖边...

2018-12-14 09:41:09 155

原创 HDU1251字典树模板

Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).     Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空...

2018-12-13 23:52:36 102

原创 周中训练总结

把博客上的kmp看完了,可是自己想总结一些东西却很难想起来,看一遍题解才能细想起来,还是理解不够好。周末之前还要把kmp专题的题目再看一遍,把博客的思想弄懂。新开字典树,kmp学了字典树就好理解一点了。最近要抓紧看字典树的博客。然后是后缀数组。...

2018-12-13 16:47:18 120

原创 字典树动态模板增删查改一

//一个以链表实现带删除功能允许重复字符串的字典树#include <stdio.h>#include <string.h>#include <stdlib.h>int charmapping[256]; //字符映射数组,charmapping[i]=x表示ascii码为i的字符对应于treenode中的next[x]void init_cha...

2018-12-13 16:44:04 158

原创 牛客 勇气获得机 从后往前推理

链接:https://ac.nowcoder.com/acm/contest/315/B来源:牛客网 题目描述妞妞听说Nowcoder Girl女生编程挑战赛要开始了, 但是她没有足够的勇气报名参加, 牛牛为了帮助妞妞,给她准备一台勇气获得机。初始的时候妞妞的勇气值是0, 勇气获得机有两个按钮:1、N按钮: 如果当期拥有的勇气值为x, 按下之后勇气值将变为2*x+1,2、G按钮...

2018-12-12 22:20:58 273

原创 CF1088模拟

http://codeforces.com/problemset/problem/1088/B#include<iostream>#include<algorithm>#include<cstring>#include<string>#include<cstdio>#include<cmath>#includ...

2018-12-12 22:19:11 151

原创 HDU4370 O OR 1

http://acm.hdu.edu.cn/showproblem.php?pid=4370//两种情况:1.1、n有无自环的闭环2.跑一遍spfa求d[n]即可取两种情况最小值#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#...

2018-12-12 13:07:03 156

转载 spfa

https://blog.csdn.net/xiao_x_miss/article/details/9721509关于求最短路径:       求最短路径的算法有许多种,除了排序外,恐怕是OI界中解决同一类问题算法最多的了。最熟悉的无疑是Dijkstra(不能求又负权边的图),接着是Bellman-Ford,它们都可以求出由一个源点向其他各点的最短路径;如果我们想要求出每一对顶点之间的最短...

2018-12-12 11:40:33 1457

原创 POJ 1236Network of Schools强联通分量

http://poj.org/problem?id=1236//看强联通分量在有向无环图中,边变为了强连通分量之间的文件传输关系。意味这:只要一个强连通分量有入边,那么就可以通过这个入边从另外一个分量中接收文件。但是,无环图意味着肯定存在没有入度(入度为0)的强连通分量,这些强连通分量没有文件来源,所以要作为投放文件的位置。那么,第一问就只需要计算出缩点后入度为0的强连通分量...

2018-12-11 10:58:10 131

原创 POJ 1961 Period (KMP)

利用next数组求解#include <cstdio>#include <cstring>using namespace std;const int maxn = 1000000 + 10;char str[maxn];int next[maxn];int len;int cas;int n; void getNext(){ int i ...

2018-12-10 17:16:42 93

转载 优先队列中排序写法

1.普通方法:priority_queue<int>qu;对入队的元素默认按照从大到小排序。2.自定义优先级:struct cmp{  bool operator()(int x,int y){    return x>y;   //从小到大排序。即x小的优先级高。}}; priority_queue<int,vector<int&gt...

2018-12-10 16:25:42 1406

原创 HDU2522最短路dirkstra 和spfa优先队列优化写法

最短路 Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 93249    Accepted Submission(s): 40413   Problem Description 在每年的校赛里,所有...

2018-12-10 15:58:49 235

原创 HDU1548最短路写法

http://acm.hdu.edu.cn/showproblem.php?pid=1548 #include <stdio.h>#include <string.h>#include <algorithm>using namespace std;const int inf = 1<<30;int n;int map[205][20...

2018-12-10 12:10:29 169

原创 HDU1548A strange lift广度优先搜索

http://acm.hdu.edu.cn/showproblem.php?pid=1548 A strange lift Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 34037    Accepted Subm...

2018-12-10 10:50:42 160

原创 HDU2594 Simpsons’ Hidden Talents 前缀与后缀转化成用s1去匹配s2

 http://acm.hdu.edu.cn/showproblem.php?pid=2594 Simpsons’ Hidden Talents Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 15076    ...

2018-12-10 10:23:38 137

原创 HDU 3746 Cyclic Nacklace(KMP:补齐循环节)

CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about ho...

2018-12-09 23:32:52 145

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除