- 博客(16)
- 收藏
- 关注

原创 线段树强化题单(欢迎补充)
1,poj 1151 Atlantis: 求矩形面积交。2,poj 1177 Picture: 求矩形轮廓的周长。3,poj 1389 Area of Simple Polygons :同第一题。4,poj 1823 Hotel :线段树线段的插入删除求线段树中最长的线段长度5,poj 2104 K-th Number:线段树维护归并排序树+三次二分查找 (区间第k大 ,主席树...
2019-02-20 11:48:48
454

原创 ACM常用知识点(欢迎补充)
ACM 所有算法数据结构 栈,队列,链表哈希表,哈希数组堆,优先队列双端队列可并堆左偏堆二叉查找树Treap伸展树并查集集合计数问题二分图的识别平衡二叉树二叉排序树线段树一维线段树二维线段树树状数组一维树状数组N维树状数组字典树后缀数组,后缀树块状链表哈夫曼树桶,跳跃表Trie树(静态建树、动态建树)AC自动机LCA和RMQ问题K...
2018-12-02 21:04:41
432
原创 leetcode 136 只出现一次的数字
好久没有刷题了 趁着假期拿leetcode练练手 找找手感 正好也可以练练Python一开始都是以简单的暴力题为主然后看到了leetcode这个题给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。说明:你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?示例 1:输入: [2,2,1]输出: 1示例2:输入: [4,1,2,1,2]输出: 4这道题很简单 暴力找一下非空元素即可只不过需注意不要额外.
2021-02-17 01:15:33
160
1
原创 Highways POJ - 2485 (最小生成树)
The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this problem. They're pla...
2019-01-16 19:48:27
187
原创 统计难题 HDU - 1251(简单字典树)
Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串.注意:...
2019-01-04 20:30:23
346
原创 不要62 HDU - 2089 (简单数位DP)
杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 88914 都属于不吉利号码。但是,61152虽然含有6和2,但不是62连号,所以不属于不吉利数字之...
2019-01-04 00:16:55
361
原创 最长回文 HDU - 3068 (Manacher)
给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如aba, abba等Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S 两组case之间由空行隔开(该空行不用处理) 字符串长度len <= 110000Output每一行一个整数x,对应一组...
2019-01-03 00:13:52
266
原创 敌兵布阵 HDU - 1166 (简单线段树)
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术,所...
2019-01-02 00:14:35
132
原创 I Hate It HDU - 1754 (简单线段树)
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M<5...
2018-12-31 20:31:46
214
原创 Networking POJ - 1287 (简单最小生成树)
You are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set of possible routes for the cables that may connect pairs of p...
2018-12-06 21:38:02
354
原创 How Many Tables HDU - 1213 (并查集)
Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, a...
2018-12-04 11:08:04
120
原创 Maximum GCD UVA - 11827(带有一点坑的暴力)
Given the N integers, you have to find the maximum GCD (greatest common divisor) of every possible pair of these integers.InputThe first line of input is an integer N (1 < N < 100) that dete...
2018-12-02 20:54:13
296
原创 N!Again HDU - 2674 (同余定理)
WhereIsHeroFrom: Zty, what are you doing ? Zty: I want to calculate N!...... WhereIsHeroFrom: So easy! How big N is ? Zty: ...
2018-12-02 20:43:29
147
原创 Big Number HDU - 1212 (Java BigInteger)
As we know, Big Number is always troublesome. But it's really important in our ACM. And today, your task is to write a program to calculate A mod B. To make the problem easier, I promise that B will ...
2018-12-02 20:23:41
178
原创 Herding HDU - 4709 (简单贪心 + 叉乘法)
Little John is herding his father's cattles. As a lazy boy, he cannot tolerate chasing the cattles all the time to avoid unnecessary omission. Luckily, he notice that there were N trees in the meadow ...
2018-12-02 20:14:01
164
原创 Divisors UVA - 294 (欧拉筛 + 素因数分解)
Mathematicians love all sorts of odd properties of numbers. For instance, they consider 945 to be an interesting number, since it is the first odd number for which the sum of its divisors is larger th...
2018-12-02 19:50:36
432
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人