自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(33)
  • 收藏
  • 关注

原创 (完全背包)hdu 1114

Piggy-BankTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24235    Accepted Submission(s): 12272Problem DescriptionBefore ACM can do

2017-04-26 19:38:06 757

原创 Bone Collector hdu2602(经典dp)01背包

Bone CollectorTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 59894    Accepted Submission(s): 24996Problem DescriptionMany years ag

2017-04-25 20:55:57 799

原创 HAUTOJ奇数最大子段和

题目描述一个大小为n的数组a1到an(−10^4≤ai≤10^4)。请你找出一个连续子段,使子段长度为奇数,且子段和最大。输入第一行为T(1≤T≤5),代表数据组数。之后每组数据,第一行为n(1≤n≤10^5),代表数组长度。之后一行n个数,代表a1到an。 输出每组数据输出一行,表示满足要求的子段和最大值样例输入141 2 3 4样例输

2017-04-25 20:19:33 1007

原创 poj to the max(最大子矩阵和) 1050(dp大法)

DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a rectangl

2017-04-20 19:49:01 685

原创 最大子段和问题(dp大法)

给定一个长度为n的一维数组a,请找出此数组的一个子数组,使得此子数组的和sum=a[i]+a[i+1]+……+a[j]最大,其中i>=0,i=i,j   31 -41 59 26 -53  58 97 -93 -23 84 子矩阵59+26-53+58+97=187为所求的最大子数组。题目很短,如果没有时间限制的话,穷举大法确实简单,但是有时间限制,只能用dp大法啦思想:

2017-04-19 17:19:40 749

原创 POJ 1163 The Triangle(数塔模型dp)

Description73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that st

2017-04-14 19:57:29 459

原创 poj 1088 滑雪(简单dp)

DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子  1 2 3 4 516 17 18 19 615 24 25 20 714 2

2017-04-14 19:46:20 406

原创 动态规划拦截导弹(基础dp)

某国为了防御敌国的导弹袭击,发展中一种导弹拦截系统。但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能高于前一发的高度。某天,雷达捕捉到敌国导弹来袭。由于该系统还在试用阶段,所以只用一套系统,因此有可能不能拦截所有的导弹。输入第一行输入测试数据组数N(1接下来一行输入这组测试数据共有多少个导弹m(1接下来行输入导弹依次飞来的高度,

2017-04-14 17:51:56 575

原创 数塔 (dp水题)

在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗? Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1  Output对于每个测试实例,输出可能

2017-04-12 20:54:29 625

原创 KMP算法

看了好久的kmp算法,先写个记录帖子记录一下,等我彻底掌握了再回来写理解。主要是看的这个大佬的博客:http://blog.csdn.net/yutianzuijin/article/details/11954939/未完待续.....

2017-04-12 20:22:39 273

原创 Shape Number HDU - 4162(最小表示法)

Problem DescriptionIn computer vision, a chain code is a sequence of numbers representing directions when following the contour of an object. For example, the following figure shows the contour repr

2017-04-12 17:21:16 376

原创 Hidden Password ZOJ - 1729(最小表示法)模板题

Some time the programmers have very strange ways to hide their passwords. See for example how Billy "Hacker" Geits hide his password. Billy chooses a string S composed of small Latin letters with le

2017-04-12 17:09:02 434

原创 (尚学杯)C.Collection Game

DescriptionPOI and POJ are pair of sisters, one is a master in “Kantai Collection”, another is an excellent competitor in ACM programming competition. One day, POI wants to visit POJ, and the pa

2017-04-05 19:42:43 467

原创 (尚学杯)B.Blind Father

DescriptionMr. Leng, who is the predominately inheritor of buried-love family  (One of the most vogue families during your primary school maybe, anyway, this is unimportant), has such cool, co

2017-04-05 19:22:50 343

原创 Heavy Transportation(Dijkstra)

Heavy TransportationTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 33893 Accepted: 8965DescriptionBackground Hugo Heavy is happy. After the breakdown

2017-03-29 19:40:02 290

原创 HDU - 4883(蛮有趣的题)

TIANKENG manages a restaurant after graduating from ZCMU, and tens of thousands of customers come to have meal because of its delicious dishes. Today n groups of customers come to enjoy their meal, an

2017-03-29 19:04:57 298

原创 Cable master (二分查找)

D - Cable master POJ - 1064 #include#include#includeusing namespace std;#define LL long longint main(){ int n,k; double m; scanf("%d%d",&n,&k); int num[10010]; for(

2017-03-29 18:59:29 406

原创 Dertouzos (结论赛高)

A positive proper divisor is a positive divisor of a number nn, excluding nn itself. For example, 1, 2, and 3 are positive proper divisors of 6, but 6 itself is not. Peter has two positive int

2017-03-28 15:56:22 488

原创 洗牌问题

设2n张牌分别标记为1, 2, ..., n, n+1, ..., 2n,初始时这2n张牌按其标号从小到大排列。经一次洗牌后,原来的排列顺序变成n+1, 1, n+2, 2, ..., 2n, n。即前n张牌被放到偶数位置2, 4, ..., 2n,而后n张牌被放到奇数位置1, 3, ..., 2n-1。可以证明对于任何一个自然数n,经过若干次洗牌后可恢复初始状态。现在你的的任务是计算对于给定的n

2017-03-28 15:48:59 494

原创 New Bus Route(第一次打codeforces)

LOL。。There are n cities situated along the main road of Berland. Cities are represented by their coordinates — integer numbers a1, a2, ..., an. All coordinates are pairwise distinct.It i

2017-03-28 15:33:40 476

原创 2017广东工业大学程序设计竞赛决赛

链接:http://gdutcode.sinaapp.com/contest.php?cid=1057Problem A: 两只老虎Description来,我们先来放松下,听听儿歌,一起“唱”。两只老虎两只老虎,跑得快跑得快。一只没有耳朵,一只没有尾巴。真奇怪,真奇怪。Tmk也觉得很奇怪,因为在他面前突然出现了一群这样的老虎

2017-03-28 15:11:25 471

原创 升降序列 (数组的运用)FZU - 1891

升降序列的定义如下:给定N个不同的整数a1,a2,…,aN组成的集合,其中N为奇数,在这N个整数集合的一个排列中,如果对于所有1i-1 i > ai+1,那么称该序列为升降序列。 给定N个不同的整数组成的集合,请你构造出一个升降序列,使得该升降序列的字典序最小。 对于有N个元素的两个整数序列A和B,如果存在下标k,使得AkBk,并且对于所有1≤iInput输入数

2017-03-24 17:32:46 550

原创 Number lengths FZU - 1050

N! (N factorial) can be quite irritating and difficult to compute for large values of N. So instead of calculating N!, I want to know how many digits are in it. (Remember that N! = N * (N - 1) * (N -

2017-03-24 17:31:18 399

原创 poj-2236 Wireless Network (并查集)

解题思路:    并查集的简单应用,对每次修好的电脑对其它已经修好的电脑遍历,    如果距离小于等于最大通信距离就将他们合并。之后判断2台电脑是不是一个集合中就KO了An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set u

2017-03-17 17:30:45 348

原创 L - 畅通工程再续 (HDU1875)-prim

相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小

2017-03-13 20:53:48 410

原创 K - 还是畅通工程 (HDU1233)-kruskal

某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( 当N为0时,输入结束,该用例不被处理。 Output对每个测

2017-03-13 20:49:49 405

原创 POJ 2387 (Dijkstra)

A - Til the Cows Come HomeBessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her bea

2017-03-08 21:22:10 516

原创 HDU2504

又见GCDTime Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18109    Accepted Submission(s): 7542Problem Description有三个正整数a,b,c(0 I

2017-03-07 16:12:41 365

原创 HDU2503

a/b + c/dTime Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13956    Accepted Submission(s): 7293Problem Description给你2个分数,求他们的和,并要求和为最

2017-03-06 20:11:41 489

原创 HDU2519

新生晚会Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13920    Accepted Submission(s): 4781Problem Description开学了,杭电又迎来了好多新生。ACMer想为新生

2017-03-06 19:49:23 356

原创 HDU2535

VoteTime Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5904    Accepted Submission(s): 3124Problem Description美国大选是按各州的投票结果来确定最终的结果的,如果

2017-03-06 19:05:23 367

原创 这次是快排————也是蛮简单的

快排就是给你一堆数,定义一个基准数,大于基准数的放右边,小于的放左边。比如说:6 1 2 7 9 3 4 5 10 8以6为基准数,大于6的放右边 小于6的放左边》》》:3 1 2 5 4 6 9 7 10 8ps:详细可以看大佬的啊哈;下面放代码:#includeint a[111],n;void quicksort(int left,int right){ i

2017-03-06 17:21:31 702

原创 桶排-概念以及代码实现

桶排就是通过一维数组来实现,是最简单最快的排序。(说了当没说 233)比如说:给你五个数 5 3 5 2 8 ,写一个代码来实现排序 :2 3 5 5 8代码如下:#includeint main(){ int a[11]; for(int i=0;i<11;i++) { a[i]=0; } int t; for(in

2017-03-04 20:02:27 650

空空如也

空空如也

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

TA关注的人

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