- 博客(17)
- 收藏
- 关注
原创 数据结构实验之串三:KMP应用 简单应用
有n个小朋友,每个小朋友手里有一些糖块,现在这些小朋友排成一排,编号是由1到n。现在给出m个数,能不能唯一的确定一对值l和r(l Input首先输入一个整数n,代表有n个小朋友。下一行输入n个数,分别代表每个小朋友手里糖的数量。之后再输入一个整数m,代表下面有m个数。下一行输入这m个数。Output 如果能唯一的确定一对l,r的值,那么输出这两个值,否则输出-1
2017-09-29 10:47:19 205
原创 Apple Tree DFS+树状数组
There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree.The tree has
2017-09-28 19:33:05 492
原创 2309 BST
Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root node is X, we can get the minimum number in this subtree by repe
2017-09-27 09:26:43 150
原创 Japan 逆序数
Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= 1000, N <= 10
2017-09-25 22:54:43 152
原创 2299 求逆序数对 归并排序/树状数组
n this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in
2017-09-25 09:22:27 173
原创 Matrix 二维树状数组 区间修改+单点查询
Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 We can change the matrix in the following way. G
2017-09-24 16:22:21 416
原创 Stars 单点修改+区间查询
Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and
2017-09-24 10:41:22 692
原创 Can you answer these queries? 区间更新和查询
A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of end
2017-09-17 22:04:03 159
原创 Count the Colors 染色
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you can see at last.I
2017-09-17 16:48:58 139
原创 Mayor's posters 离散化+线段树染色
The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally d
2017-09-17 16:40:52 159
原创 Python xlrd xlwt读写Excel
需求:给你一个学生名单(Excel表格),统计在一个比赛(开放)中,名单上所有学生的AC情况,要求语言是java名单上有三列:学号,姓名,分组 最后统计的时候我在新表格中加了三列:OJ昵称,AC数量,用JAVA AC的数量其实这个任务一开始对我来说真有点困难,主要是用Python操作Excel,这个我之前没接触过,而且和网页爬虫结合在一起,即把爬虫爬下来的数据整理后写入新的Excel表格,
2017-09-14 16:09:30 468
原创 A Simple Problem with Integers 区间更新和查询
You have N integers, A1, A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the
2017-09-10 21:53:16 160
原创 I Hate It 单点修改和区间查询
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0学生ID编号分别从1编到N。 第二
2017-09-09 23:52:25 168
原创 效率至上 区间最值
题意很简单,给出一个数目为n的非有序序列,然后有m次查询.对于每次查询输入两个正整数l,r请输出区间[l,r]的最大值与最小值的差值Input 第一行:输入两个正整数n,m (1;第二行:输入n个整数 大小范围为[1,100000];接下来的m行,每次两个正整数l,r (1Output 输出区间[l,r]最大值与最小值的差值.Example In
2017-09-09 11:24:58 337
原创 数组计算机 单点更新和区间查询
bLue 有一个神器的机器,这个机器可以读入一个数组,并按照用户要求快速地进行数组的处理和计算,它支持如下两种操作:操作 1:把数组中第 p 个元素的值增加 v。操作 2:计算数组中 [l, r] 区间内所有数的和。这个机器就是这么的神奇,但是 bLue 的计算机坏掉了,你能帮他修一下吗?Input输入数据有多组(数据组数不超过 20),到 EOF 结束。对于每组数
2017-09-08 23:05:44 199
原创 Dirichlet's Theorem on Arithmetic Progressions 筛取素数
If a and d are relatively prime positive integers, the arithmetic sequence beginning witha and increasing by d, i.e., a, a + d,a + 2d, a + 3d, a + 4d, ..., contains infinitely many prime numbers.
2017-09-07 15:15:12 182
原创 将爬取的数据存储为json文件
以盗墓笔记小说阅读网为例吧,获取章节的信息和链接,毕竟我高中时也是一颗稻米,看过第一本和第八本书,电视剧电影也都看过,很喜欢张起灵和吴邪一开始我并不知道这个网站↓这次我没用Python的urllib2库,学了requests库,就用了get函数,不过这个确实比之前的urllib/urllib2/cookielib库简洁方便。我本以为这个网站get的时候顶多加个headers就行了,
2017-09-05 21:57:26 11760 6
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人