- 博客(22)
- 资源 (11)
- 收藏
- 关注
原创 HUST 1559 ACM(树状数组)
ACMTime Limit: 2 Sec Memory Limit: 128 MBSubmissions: 166 Solved: 16DescriptionJianhe25 is a ACMer, he loves "ACM" very much, so he wants to know how many times "ACM" appear in the strin
2013-12-27 16:09:57 794
原创 POJ 3321 Apple Tree(树状数组)
题目链接:http://poj.org/problem?id=3321很好的一题思路,后序遍历求出编号建立树状数组,根节点管理子节点,同时记录子节点个数(DFS),最后树状数组维护区间和主要是要找出各个节点之间的包含关系#include #include #include #include #include #include using namespace std;c
2013-12-27 11:03:59 564
原创 POJ 1253 SPF(tarjan算法求割点)
题目链接:http://poj.org/problem?id=1523只要子不能通过子节点回到父节点的父节点的某个节点,那么就能确定这个点是割点在确定去掉之后有几个分量就是看DFS回来满足几次条件就是几次,注意根节点的处理#include #include #include #include #include using namespace std;const int ma
2013-12-26 13:50:41 797
原创 山谷(思维)
描述八百里伏牛山连绵不断,高低起伏。学习过数山谷的个数之后,小明想知道这些山谷中最多能装多少水。我们用竖直的矩形表示山的高度,如图:我们用这样一种形式来表示上图的山:[6 1 4 6 7 5 1 6 4],每个数字代表山的高度。假如连日暴雨,爆发山洪,这些山之间的山谷能装多少水?规定用单位1的方块来计算容积。所以,在上边的图中下标
2013-12-21 10:55:04 856
原创 HUST 1025 Sequence(递归 + 重复计算消除)
题目链接:http://acm.hust.edu.cn/problem.php?id=1025Consider the special sequence of numbers, which satisfies the following requirements: a[0] = 0; a[1] = 1; for every i = 1, 2, 3, ... a[2*i]
2013-12-20 20:57:39 758
原创 HUST 1004 String Compare(字符串前缀对)
题目链接:http://acm.hust.edu.cn/problem.php?id=1004Maybe there are 750,000 words in English and some words are prefix of other words, for example: the word "acm" can be treat as one prefix of "acmicpc".
2013-12-20 14:35:21 844
原创 HUST 1003 Sibonacci Numbers(杂题)
题目链接:http://acm.hust.edu.cn/problem.php?id=1003As is known to all, the definition of Fibonacci Numbers is:f(1)=1f(2)=1f(n)=f(n-1)+f(n-2) (n>=3)Now Sempr found another Numbers, he named it
2013-12-20 13:01:33 985
原创 HDU Monkey King(左偏树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1512这个题目其实是用左偏树来做的,可是队友直接用优先队列搞了,分析了下复杂度还真对因为最坏情况下是n*logn*logn的复杂度,也就是说不会有很多次打架的,十万次查询很多都是-1除非是从小打到大也就是每次合并优先队列的时候小的往大的里面并,次数最坏也不会太多我就是左偏树+并查集搞
2013-12-19 20:11:06 695 1
原创 HSUT 1628 LowerBound(划分树+二分)
LowerBoundTime Limit: 1 Sec Memory Limit: 128 MBSubmissions: 8 Solved: 7DescriptionYou are given a sequence A[1], A[2], ..., A[N] . ( |A[i]| ≤ 2*10^9, 1 ≤ N ≤ 100000 ). A query is def
2013-12-19 13:53:44 1139
原创 POJ 2104 K-th Number(划分树)
题目链接:http://poj.org/problem?id=2104给定数组,和任意区间,求这个区间内第K大数划分树的典型题划分树具体讲解我是看http://shizhixinghuo.diandian.com/post/2012-09-02/40037691896#include #include #include #include using namespace st
2013-12-19 13:40:20 673
原创 HUST 1624 Beautiful Sky(判断两图形是否相同)
Beautiful SkyTime Limit: 1 Sec Memory Limit: 128 MBSubmissions: 8 Solved: 3DescriptionThe 8th(2013) ACM Programming Contest of HUST Problem SetLittle Mine is a naughty boy. He was once a
2013-12-18 12:21:47 1006
原创 HUST 1632 Sheep’s Toy I(计算几何 正方形旋转覆盖面积)
题目链接:http://acm.hust.edu.cn/problem.php?id=1632很简单的一道几何题目,利用的知识就是初中的,推推角度之间的关系,注意点细节就OK了。#include #include #include #include #include using namespace std;const double pi = acos(-1.0);int ma
2013-12-14 13:10:23 714
原创 HUST 1630 largest rectangle(思维题)
largest rectangleTime Limit: 1 Sec Memory Limit: 128 MBSubmissions: 11 Solved: 4DescriptionGiven n positive integers representing the histogram's bar height where the width of each bar is
2013-12-13 14:25:09 724
原创 HDU 2844 Coins(DP 背包)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2844求背包能装满的情况的条数,参见背包九讲,二进制优化完全背包和多重背包问题#include #include #include #include using namespace std;const int maxn = 100100;int dp[maxn];int n,m,v
2013-12-13 13:26:53 503
原创 HDU 3531 Match(树状数组)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3531输入两个0-1矩阵,判断后一个是不是前一个的子矩阵开始暴力判断,结果超时后来用树状数组维护枚举区间1的个数,在1的个数相等的情况下来判断是否相等!#include #include #include #include using namespace std;const i
2013-12-04 19:14:48 737
原创 HDU 4666 Hyperspace(STL set 最近哈密顿距离)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4666题意:输入n和k,n表示操作数,k表示点的维数,下面n行,每行输入一个op,为0后输入k个数表示坐标,这点存在了,op为1,输入一个数表示这个操作的点去除输出每步操作之后的存在的点的最远哈密顿距离首先要理解最远哈密顿距离的二进制求法,然后维护若干个set,每次插入或者删除,更新相应的位
2013-12-04 15:18:19 697
原创 HDU 3530 Subsequence(STL)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3530题意:给定一个长度为n的数组,n最大为10万,让你求最长区间长度使这个区间的最大值减去最小值在m和k之间(包括m和k)开始以为是什么树状数组什么的,后来看见时间给的是1s,就往O(n)的方向去想用两个set维护当前区间的最大值和最小值,如果最大值与最小值差比k大,如果end继续向后走一
2013-12-04 14:05:02 673
原创 POJ 2926 Requirements(多维最远曼哈顿距离)
题目链接:http://poj.org/problem?id=2926这个题目是看算法合集之《浅谈信息学竞赛中的“0”和“1”》后做的,二进制思想的经典应用具体如下(x1-x2) + (y1-y2), (x1-x2) + (y2-y1), (x2-x1) + (y1-y2), (x2-x1) + (y2-y1)变形下:(x1+y1) - (x2+y2), (x1-y
2013-12-04 13:09:07 783
原创 POJ 2155 Matrix(二维树状数组)
题目链接:http://poj.org/problem?id=2155这个题目和上面一题一样,不过这个还简单点先理解一维的再来理解二维的就好多了看算法合集之《浅谈信息学竞赛中的“0”和“1”》上面讲的比较清楚#include #include #include #include using namespace std;const int maxn = 1005;int
2013-12-03 20:58:39 574
原创 HDU 3333 Turing Tree(树状数组)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3333离线处理的好题目首先对查询区间进行右端点排序,每次求的时候把下标小于右端点的值插入树状数组每次插入一个值的时候检查这个数字是否在前面出现,出现过就删除前面的,。保留当前的反正就是每个元素保留一个,且保留的是最后出现的一个,在计算查询区间的时候就可以直接查询,最后输出结果即可!(
2013-12-03 13:29:13 615
原创 HDU 3584 Cube(三维树状数组)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3584这个题目树状数组比较明显由于只是两种变化,所以只要统计变化的次数就可以了每次变化的是一个区间,更新的时候就按照点一样的更新方法求和时求某个点的,其实就是求变化次数任何一段在往下加的时候总能加到你更新的那个位置,如果加不到你也一定会加到你的某个上司,没影响的也会加,不过更新的
2013-12-03 12:16:52 769
原创 HDU 1892 See you~(二维树状数组)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1892很明显的二维树状数组的题目,注意点细节!#include #include #include #include using namespace std;#define maxn 1010int map[maxn][maxn];int tree[maxn][maxn];int
2013-12-02 11:00:21 604
HTTP权威指南》高清中文版.pdf
2015-01-29
The Healthy Programmer.pdf
2015-01-29
pop star 游戏 ubuntu 终端版本
2013-04-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人