- 博客(51)
- 收藏
- 关注
原创 Android空指针异常小结——微型技术报告1
在开发新闻客户端的过程中,经常会出现空指针的问题。空指针异常通常是不出现则以一出现就有惊人的破坏力。因为自己水平有限,想着以后的开发过程中也会有遗漏的地方,所以特来总结一下经常出现的问题。下面举例说明:(并解释何为空指针异常)1.所谓的指针,就是java中的对象的引用。比如String s;这个s就是指针。2.所谓的空指针,就是指针的内容为null,比如上面的s,如果令它指向null,...
2019-06-17 06:29:47
551
原创 字典树基础模板
1.查询一个单词是否出现/* trie tree的储存方式:将字母储存在边上,边的节点连接与它相连的字母 trie[rt][x]=tot:rt是上个节点编号,x是字母,tot是下个节点编号 */ #include<cstdio>#include<iostream>#include<algorithm>#include<cstring&g...
2018-05-09 19:44:52
208
原创 2018武大校赛.D. Who killed Cock Robin(树形dfs)
链接:https://www.nowcoder.com/acm/contest/104/C来源:牛客网题目描述 由于系统限制,C题无法在此评测,此题为现场赛的D题 Who killed Cock Robin? I, said the Sparrow, With my bow and arrow,I killed Cock Robin. Who saw ...
2018-04-23 17:45:33
383
原创 UVALive 7261 Xiongnu's Land
题目大意:给一个矩形区域的右上角的坐标(R,R)的值R,这个矩形区域的左下角的坐标为(0,0),再在这个矩形区域里面给出n个小矩形,现在求一条垂直于x轴的分割线使得线左右两边的小矩形面积在满足,左>右的情况下尽可能的接近;思路:统计一下每个点左右两边的值,暴力来解决,遍历一遍就ok了#include<cstdio> #include<cstring> #inc...
2018-04-23 17:06:36
206
转载 启发式算法
https://shaoweicai.wordpress.com/2010/09/23/%E5%90%AF%E5%8F%91%E5%BC%8F%E7%AE%97%E6%B3%95%EF%BC%88heuristic-algorithm%EF%BC%89/启发式算法(Heuristic Algorithm)有不同的定义:一种定义为,一个基于直观或经验的构造的算
2018-04-18 20:27:44
2670
原创 Codeforces 961C Chessboard
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even wo
2018-04-08 19:54:10
268
原创 Codeforces-462C. A Twisty Movement(前缀和/dp)
C. A Twisty Movementtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people m...
2018-03-19 18:32:45
246
原创 Codeforces 931.C Laboratory Work
C. Laboratory Worktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnya and Kirill are doing a physics laboratory work. In one of the tasks they hav...
2018-03-08 17:26:45
311
原创 Codeforces Round #468 B. World Cup
B. World CupThe last stage of Football World Cup is played using the play-off system.There are n teams left in this stage, they are enumerated from 1 to n. Several rounds are held, in each round the r...
2018-03-08 17:03:17
201
原创 cf 461 div2.C. A Twisty Movement
C. A Twisty Movementtime limit per test 1 secondmemory limit per test 256 megabytesA dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day,people model a dragon with bamboo strips ...
2018-03-08 07:42:17
210
原创 POJ3321-Apple Tree(dfs序+线段树)
poj3321 原题链接:http://poj.org/problem?id=3321Apple TreeTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 30871 Accepted: 9243DescriptionThere is an apple tree outside of kaka's house. Every autu...
2018-02-11 19:54:23
237
原创 cf #div2.461-C.Cave Painting
C. Cave Paintingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputImp is watching a documentary about cave painting.Some numbers, carved in chaotic o...
2018-02-10 13:02:30
243
原创 CFR 461 DIV2-D. Robot Vacuum Cleaner
D. Robot Vacuum Cleanertime limit per test 1 second memory limit per test 256 megabytesProblem DescriptionPushok the dog has been chasing Imp for a few hours already. Fortunately, Imp knows that Push...
2018-02-10 12:56:27
851
原创 POJ2528-Mayor's posters(线段树+离散化)
原题地址:点击打开链接Mayor's postersTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 70678 Accepted: 20384DescriptionThe citizens of Bytetown, AB, could no
2017-11-30 21:55:23
273
2
原创 icpc-beijing-cats and fish
原题:时间限制:1000ms单点时限:1000ms内存限制:256MB描述There are many homeless cats in PKU campus. They are all happy because the students in the cat club of PKU take good care of them. Li lei
2017-11-22 14:26:30
270
原创 2017icpc-beijing-j(pangu and stone)
同学去的比赛,j题是个dp就补了一下原题:点击打开链接#1636 : Pangu and Stones时间限制:1000ms单点时限:1000ms内存限制:256MB描述In Chinese mythology, Pangu is the first living being and the creator of th
2017-11-22 13:59:09
521
原创 POJ1328-Radar Installation(贪心)
POJ1328Radar InstallationTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 93037 Accepted: 20765DescriptionAssume the coasting is an infinite stra
2017-11-01 18:47:24
440
原创 POJ3107-God father(树形dp??)
原题链接:http://poj.org/problem?id=3107GodfatherTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 6121 Accepted: 2164DescriptionLast
2017-10-25 18:12:56
242
原创 HDU2196-Computer(树形dp)
原题传送门ComputerTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 31201 Accepted Submission(s): 3989Problem DescriptionA school bo
2017-10-18 17:12:23
251
1
原创 HDU1520-Anniversary party(树形dp)
Problem DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervi
2017-10-13 19:27:25
201
原创 POJ1182-食物链(经典并查集)
题目链接:poj拉闸了http://poj.org/problem?id=1182题意:动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: “1 X Y”,表示X和Y是同类。 “
2017-10-11 21:06:42
185
原创 POJ1644-(放苹果)-递归
原题链接:http://poj.org/problem?id=1664放苹果Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 34897 Accepted: 21600Description把M个同样的苹果放在N个同样的盘子里,允
2017-10-11 17:48:13
219
原创 队内训练赛--A(Tree)
Problem A: TreeTime Limit: 2 Sec Memory Limit: 1280 MBSubmit: 29 Solved: 6[Submit][Status][Web Board]Description众所周知,华农是武汉面积最大的校园之一,我们想象华农为n的点组成的一棵树,我们知道每棵树一共有n * (n - 1) / 2条不同的链,而每一条
2017-10-09 17:47:14
205
原创 POJ1276-Cash Machine(多重背包)
题目链接:poj挂了以后补上DescriptionA Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N dis
2017-10-07 21:57:41
420
原创 51nod-1376(线段树维护区间最值)
51nod 1376 最长递增子序列的数量数组A包含N个整数(可能包含相同的值)。设S为A的子序列且S中的元素是递增的,则S为A的递增子序列。如果S的长度是所有递增子序列中最长的,则称S为A的最长递增子序列(LIS)。A的LIS可能有很多个。例如A为:{1 3 2 0 4},1 3 4,1 2 4均为A的LIS。给出数组A,求A的LIS有多少个。由于数量很大,输出Mod 100000000
2017-10-07 16:39:33
436
原创 POJ 2752-Seek the Name, Seek the Fame(KMP的next数组运用)
poj 2752Seek the Name, Seek the FameTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 8261 Accepted: 3883DescriptionThe little cat i
2017-10-03 15:45:46
187
原创 POJ-3461(KMP模版题)
poj3461,原题链接:POJ挂了贴不出来题目大意:给一个主串和子串,求子串在主串中出现的次数;思路:KMP模版题,代码如下:#include#include#include#includeusing namespace std;const int N=1e6+10;char T[N];char P[N];int next[N];int sum;void
2017-10-03 15:29:13
184
原创 noip2015-跳石头(二分答案)
原题传送门:http://uoj.ac/problem/148#148. 【NOIP2015】跳石头 统计 描述 提交 自定义测试一年一度的“跳石头”比赛又要开始了!这项比赛将在一条笔直的河道中进行,河道中分布着一些巨大岩石。组委会已经选择好了两块岩石作为比赛起点和终点。在起点和终点之间,有 NN 块岩石(不含起点和终点的岩石)。在比赛过程中,选手们将从
2017-09-28 13:59:24
5643
3
转载 最短路径—Dijkstra算法和Floyd算法
Dijkstra与Floyd算法原文出处:http://www.cnblogs.com/biyeymyhjob/archive/2012/07/31/2615833.htmlDijkstra算法1.定义概览Dijkstra(迪杰斯特拉)算法是典型的单源最短路径算法,用于计算一个节点到其他所有节点的最短路径。主要特点是以起始点为中心向外层层扩展,直到扩展到终点为止。D
2017-09-27 16:51:19
178
原创 POJ3254-Corn Fields(状压dp)
原题链接:http://poj.org/problem?id=3254Corn FieldsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 16740 Accepted: 8845DescriptionFarmer John has pur
2017-09-27 15:46:12
272
原创 The Heaviest Non-decreasing Subsequence Problem ACM-ICPC南宁wa
Let SS be a sequence of integers s_{1}s1, s_{2}s2, ......, s_{n}sn Each integer is is associated with a weight by the following rules:(1) If is is negative, then its weight is 00.(2)
2017-09-25 16:44:26
197
原创 ACM-ICPC北京赛区网络赛2017-minimum(线段树)
题目9 : Minimum时间限制:1000ms单点时限:1000ms内存限制:256MB描述You are given a list of integers a0, a1, …, a2^k-1.You need to support two types of queries:1. Output Minx,y∈[l,r] {ax∙ay}.2.
2017-09-25 16:05:26
242
原创 邻接表-数组的实现
邻接表-数组的实现 前些天做了一道poj3321,这道题是一个dfs序+树状数组/线段树,看了许久没有看懂,没有看懂的地方不是dfs序或者线段树/树状数组,而是邻接表建树(数组),总结了一下方法流程。 先任意给几条边用作例子:4 5 //四条边,五个点1 4 //点1,4中有一条边4 3 1 2 2 4 1.定义两个数组first和next
2017-09-21 19:54:16
2264
原创 POJ1840-Eqs(hash)
POJ1840 原题链接:http://poj.org/problem?id=1840EqsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 16935 Accepted: 8312DescriptionConsider equations
2017-09-19 16:19:41
328
原创 POJ3349-Snowflake Snow Snowflakes(hash表)
POJ3349 原题链接:http://poj.org/problem?id=3349Snowflake Snow SnowflakesTime Limit: 4000MS Memory Limit: 65536KTotal Submissions: 43393 Accepted: 11385Description
2017-09-19 15:04:34
380
原创 数据结构基础--单链表逆序
最近同学问了一道在数据结构的课本上的题,做了很久才做出来,可见课本和基础是很重要的题目是将一个单链表逆序但是不允许申请额外的空间做中转思路大抵
2017-09-17 16:30:14
539
原创 Sum-2017 ACM-ICPC 亚洲区(西安赛区)
Define the function S(x)S(x) for xx is a positive integer. S(x)S(x) equals to the sum of all digit of the decimal expression of xx. Please find a positive integer kk that S(k*x)\%233=0S(k∗x)%233
2017-09-16 15:56:01
613
原创 POJ1936-All in All(纯水题)
POJ1936 原题链接:http://poj.org/problem?id=1936All in AllTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 33646 Accepted: 14057DescriptionYou have de
2017-09-14 21:32:45
535
原创 POJ2299-Ultra-QuickSort(树状数组+离散化)
POJ2299 原题链接:http://poj.org/problem?id=2299Ultra-QuickSortTime Limit: 7000MS Memory Limit: 65536KTotal Submissions: 63588 Accepted: 23705DescriptionIn thi
2017-09-14 21:04:15
427
原创 poj1836-Alignment(LIS)
poj1836 原题链接:http://poj.org/problem?id=1836DescriptionIn the army, a platoon is composed by n soldiers. During the morning inspection, the soldiers are aligned in a straight line in front of t
2017-09-12 19:17:56
281
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人