自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 hdu 3533 secape

转自:http://blog.csdn.net/libin56842/article/details/41909459Problem Description The students of the HEU are maneuvering for their military training. The red army and the blue army are at war today. Th

2017-01-25 16:23:23 550

原创 hdu 1495 非常可乐(bfs)

大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好装满一瓶) ,它们三个之间可以相互倒可乐 (都是没有刻度的,且 S==N+M,101>S>0,N>

2017-01-25 16:17:17 298

原创 poj 3126 prime path(bfs)

The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of se

2017-01-25 16:15:28 355

原创 hdu 5583 暴搜加剪枝

In mathematics, the four color theorem, or the four color map theorem, states that, given any separation of a plane into contiguous regions, producing a figure called a map, no more than four colors ar

2017-01-25 16:12:08 375

原创 hdu 3345 War chess(bfs)

War chess is hh’s favorite game: In this game, there is an N * M battle map, and every player has his own Moving Val (MV). In each round, every player can move in four directions as long as he has en

2017-01-25 15:54:11 625

原创 hdu 2102 A计划

可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。 现据密探所报,公主被关在一个两层的迷宫里,迷宫的入口是S(0,0,0),公主的位置用P表示,时空传输机用#表示,墙用*表示

2017-01-25 15:37:39 283

原创 hdu 2553 n皇后的简单写法

分析:深搜,回溯,n皇后问题的最简单解法,一维数组,注意要打表,不然每输入一个就深搜一次 会超时 其实一维二维没什么区别,在判断斜线的时候可以想到一个矩阵,如果求它的45度斜线,如果斜线是45度,必然是i增加,j减少,而且增量绝对值相等,可以得出i+j是相等的,如果是135度,两者的增量相等,i-j肯定是相等的。这是斜线的性质。#include <cstdio>#include <iostrea

2017-01-25 12:17:17 355

原创 hdu 3466 要排序的动归

两天时间的思考, 首先要理解无后效性,动归的一个应用条件就是无后效性,在普通背包里面,是否排序它都是无后效性的,我觉得理解的时候得按照现实和代码两种理解,因为代价和价值相等,所以在dp数组里面是否排序,其实在决策之间是不会相互影响的,把这个阶段买不买的最优情况记录下来,然后下个阶段也会有根据当前最优阶段的买不买的情况,而且在这个普通01背包过程中,买不买都会有相应的情况表示,而不会有如果你这个阶段

2017-01-23 02:08:24 668

原创 hdu 6011 lotus and characters

Lotus has nn kinds of characters,each kind of characters has a value and a amount.She wants to construct a string using some of these characters.Define the value of a string is:its first character’s va

2017-01-22 13:39:04 1059 3

原创 蓝桥 小朋友排队(树状数组)

历届试题 小朋友排队 时间限制:1.0s 内存限制:256.0MB 提交此题 问题描述   n 个小朋友站成一排。现在要把他们按身高从低到高的顺序排列,但是每次只能交换位置相邻的两个小朋友。  每个小朋友都有一个不高兴的程度。开始的时候,所有小朋友的不高兴程度都是0。  如果某个小朋友第一次被要求交换,则他的不高兴程度增加1,如果第二次要求他交换,则他的不高兴程度增加2(即不高兴程度为3

2017-01-21 15:09:56 520

原创 蓝桥 迷宫寻宝 记忆化搜索

问题描述   X 国王有一个地宫宝库。是 n x m 个格子的矩阵。每个格子放一件宝贝。每个宝贝贴着价值标签。  地宫的入口在左上角,出口在右下角。  小明被带到地宫的入口,国王要求他只能向右或向下行走。  走过某个格子时,如果那个格子中的宝贝价值比小明手中任意宝贝价值都大,小明就可以拿起它(当然,也可以不拿)。  当小明走到出口时,如果他手中的宝贝恰好是k件,则这些宝贝就可以送给小明。  请你帮

2017-01-21 11:24:27 795

原创 codeforces 392 div2 unfair poll

C. Unfair Poll time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output On the Literature lesson Sergei noticed an awful injustice, it seems that so

2017-01-20 20:09:19 502

原创 codeforces 392 div2 D ability to convert

D. Ability To Convert time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alexander is learning how to convert numbers from the decimal

2017-01-20 20:00:46 327

原创 背包dp小tips

1.一维的01背包为啥要逆序(保证更新f[j]时,f[ j - weight[i] ]是没有放入物品i时的数据即f[ i - 1 ][ j - weight[i] ],因为01背包每个物品至多被选一次。而完全背包中,每个物品可以被选无限次,那么状态f[i][j],正好可以由可能已经放入物品i的状态f[ i - 1 ][ j - weight[i] ]转移而来。所以,遍历顺序改为顺序时,就是完全背包问

2017-01-19 00:23:22 369

原创 hdu 2639 Bone Collector II DP(第i最优决策)

The title of this problem is familiar,isn’t it?yeah,if you had took part in the “Rookie Cup” competition,you must have seem this title.If you haven’t seen it before,it doesn’t matter,I will give you a

2017-01-19 00:14:41 303

原创 codefoeces 755B

题意:两个人两张表,里面可能有相同的词,每人说一个新词,不能说的就输了 没读好题被hack掉,给定两个表分别是 You’re given two lists of words familiar to PolandBall and EnemyBall. 那么其实要求的是相同的词的个数,如果相同的词有奇数个其实就是第一个读的人可以有多一个词,如果是偶数个,那么二者相同 贴代码#include

2017-01-17 10:42:42 410

原创 poj 1942 走地图的组合数学

题意:求从左下角出发只能往右走和往上走,给定矩阵n*m,求有多少中走法,组合数学,求Cn(n+m)或Cm(n+m)为了减少计算量,去小的那个,三个for肯定会爆掉,而杨辉三角规模只能20+太少 解决方法 拆分阶乘,逐项相除,再乘以前面所有项之积。这种方法用一个循环就OK了,时间复杂度只有O(n-m),非常可观。 某大牛写的函数原型: double cnm=1.0;while(b>0)cn

2017-01-17 09:55:46 313

转载 poj 3040 深入理解贪心思想

AllowanceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 2300Accepted: 945DescriptionAs a reward for record mil

2017-01-17 09:50:19 507

原创 uva 11987 带删除的并查集

Initially, the collection contains n sets: {1}, {2}, {3}, … , {n}. Input There are several test cases. Each test case begins with a line containing two integers n and m (1 ≤ n, m ≤ 100, 000), the nu

2017-01-16 22:33:52 648

原创 hdu 2818 Building Blocks (并查集)

John are playing with blocks. There are N blocks (1 <= N <= 30000) numbered 1…N。Initially, there are N piles, and each pile contains one block. Then John do some operations P times (1 <= P <= 1000000).

2017-01-16 21:29:38 553

原创 codeforces 722c 用并查集求缺省的最大子序列

You are given an array consisting of n non-negative integers a1, a2, …, an.You are going to destroy integers in the array one by one. Thus, you are given the permutation of integers from 1 to n definin

2017-01-16 20:55:44 421

原创 HDU 1024 MAX SUM PLUS PLUS

Now I think you have got an AC in Ignatius.L’s “Max Sum” problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced with a more difficult problem. Given a

2017-01-14 17:26:41 807

转载 最小生成树四种方法概括

http://www.cnblogs.com/aiyelinglong/archive/2012/03/26/2418707.html转给自己看带权图分为有向和无向,无向图的最短路径又叫做最小生成树,有prime算法和kruskal算法;有向图的最短路径算法有dijkstra算法和floyd算法。  生成树的概念:联通图G的一个子图如果是一棵包含G的所有顶点的树,则该子图称

2017-01-06 00:55:04 2109

原创 Codeforces 742B

There are some beautiful girls in Arpa’s land as mentioned before.Once Arpa came up with an obvious problem:Given an array and a number x, count the number of pairs of indices i, j (1 ≤ i < j ≤ n) such

2017-01-05 23:20:35 383

空空如也

空空如也

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

TA关注的人

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