自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(27)
  • 资源 (1)
  • 收藏
  • 关注

原创 poj 3070-Fibonacci-矩阵幂乘

FibonacciTime Limit: 1000msMemory Limit: 65536KBThis problem will be judged on PKU. Original ID: 307064-bit integer IO format: %lld      Java class name: MainPrev Submit Status Sta

2013-04-30 19:40:47 1756

原创 poj 3164-最小树形图

参考博文:http://www.cnblogs.com/nanke/archive/2012/04/11/2441725.htmlF - Command NetworkTime Limit:1000MS     Memory Limit:131072KB     64bit IO Format:%I64d & %I64uSubmit Status Practic

2013-04-29 10:40:19 715

原创 poj 1422 - 最小路径覆盖

题意:一个地图上有n个小镇,以及连接着其中两个小镇的有向边,而且这些边无法形成回路。现在选择一些小镇空降士兵(1个小镇最多1个士兵),士兵能沿着边走到尽头,问最少空降几个士兵,能遍历完所有的小镇。最小路径覆盖问题,因为是有向图,就可以把一条路径拆成起点和终点,从而建立二分图最小路径覆盖 = 节点数 - 最大匹配数G - Air RaidTime Limit:

2013-04-28 23:52:39 1645

原创 poj 2075-最小生成树-map映射

很好很强大的map、、A - Tangled in CablesTime Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 2075DescriptionYou are the owner

2013-04-28 23:37:46 1260

原创 poj - 1423-Big number

H - Big NumberTime Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 1423DescriptionIn many applications very large integers numbe

2013-04-28 23:31:37 922

原创 poj-1146-全排列

ID CodesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 5336 Accepted: 3190DescriptionIt is 2084 and the year of Big Brother has finally arrived, albe

2013-04-28 23:21:34 2037 1

原创 SPOJ BYTESE1 - spfa(最短路+搜索)

DescriptionLUCIUS’ DUNGEON (5 points) There are a set of rooms in a dungeon, arranged in an M × N rectangular grid. In one of the rooms, evil Lucius Malfoy has imprisoned Hermione, owing to his ha

2013-04-26 22:57:28 1243

原创 poj 2594-flody + 最小路径覆盖

首先明确:最短路径数 = 节点数 - 最大匹配题目意思:给你一个有向无环图,有n个点,m条有向边。一个机器人可以从任意点开始沿着边的方向走下去。对于每一个机器人:走过的点不能再走过。问你最少用几个机器人可以走完所有的n个点,不同的机器人可以走相同的点。这个题目是可以重点的,就是一个点可以有多路径覆盖,解释什么叫可以重点,上图中要是可以重点,那

2013-04-25 01:00:03 703

原创 poj 3982- 序列-大整数加法

B - 序列Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64uSubmit Status Practice POJ 3982Description数列A满足An = An-1 + An-2 + An-3, n >= 3 编写程序,给定A0,

2013-04-25 00:37:06 849

转载 几个最短路径算法Floyd、Dijkstra、Bellman-Ford、SPFA的比较

转载自:http://blog.csdn.net/v_july_v/article/details/6181485几大最短路径算法比较 July、二零一一年二月十二日。-----------------------------------  几个最短路径算法的比较:Floyd       求多源、无负权边的最短路。用矩阵记录图。时效性较差,时

2013-04-23 23:48:13 948

原创 CodeForces 248B - Chilly Willy - 找规律

Chilly Willy loves playing with numbers. He only knows prime numbers that are digits yet. These numbers are 2, 3, 5 and 7. But Willy grew rather bored of such numbers, so he came up with a few games

2013-04-22 23:43:46 1303

原创 poj - 2186- 强连通 - 最受欢迎的牛的个数

刘汝佳的书上有详细的介绍, 并且这个代码几乎和书上的是一样的强连通就是“相互到达的关系”,每一个集合称为有向图的一个强连通分量。如果把每一个集合看成一个点,那么所有SCC构成一个SCC图,这个SCC图不会存在有向环,因此是一个DAG------------------"缩点"此题用了个定理 :有向无环图(DAG)中,从任意一个点出发,必定可以到达某一个出度为0的点。这个不用

2013-04-22 17:59:20 838

原创 hdu-1598-最佳路线的舒适度最高速与最低速的差-并查集

XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的差越小乘坐越舒服 ,(理解为SARS的限速要求,flycar必须瞬间提速/降速,痛苦呀 ),但XX星人对时间

2013-04-12 19:17:15 1048

原创 poj-3624-Charm Bracelet0-1背包

DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each

2013-04-09 23:01:41 1998

原创 poj- 1948- Triangular Pastures-DP

Like everyone, cows enjoy variety. Their current fancy is new shapes for pastures. The old rectangular shapes are out of favor; new geometries are the favorite. I. M. Hei, the lead cow pasture arc

2013-04-09 20:39:09 1037

原创 hdu-3592-World Exhibition-差分约束

DescriptionNowadays, many people want to go to Shanghai to visit the World Exhibition. So there are always a lot of people who are standing along a straight line waiting for entering. Assume that

2013-04-08 23:21:07 645

原创 hdu 1548-A strange lift-最短路-dijkstra

DescriptionThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at f

2013-04-08 21:38:07 647

转载 差分约束2

转载注明出处:http://www.cppblog.com/abilitytao/archive/2009/08/21/94061.html(本文假设读者已经有以下知识:最短路径的基本性质、Bellman-Ford算法。)    比如有这样一组不等式:   X1 - X2 X1 - X5 X2 - X5 X3 - X1 X4 - X1 X4 - X3

2013-04-07 21:01:13 542

原创 差分约束

最近想学习差分约了。。整理一下资料吧     所谓差分约束系统,是指一组不定方程(A,x,T,b),其中A的每行有一个1,一个-1,其余为0,x为解向量,T为=组成的向量,b为约束矢量。具体来说,就是每行都具有 xi-xj >=|       假设一个系统由n个变量和m和约束条件组成,约束条件形如:xj - xi 类似于最短路中的三角不等式:dis[j] 因此,以每

2013-04-07 20:56:50 745

原创 Uva 10608- 并查集,最大的朋友个数

Problem IFRIENDS There is a town with N citizens. It is known that some pairs of people are friends. According to the famous saying that “The friends of my friends are my friends, too” it fo

2013-04-06 19:47:23 963

原创 poj - 2833- The Average

题目意思: 去掉前面n1 个最高分,去掉后面n2 个最低分,求平均分由于数据比较大,直接排序sort。。会超时的。。就用原始的方法吧。。#include #include #include using namespace std;#define INF 1000000005int Min[11];int Max[11];void init () { memset(Max

2013-04-05 22:38:11 1138

原创 n的阶乘最后一个非0的数

哈哈~要说这个题目,中午比赛的时候1AC了、、归功于之前写过的求大数的阶乘这个算法啊。。在电脑上调试了一会,发现求阶乘的过程是一段段输出的。。就比如说10的阶乘,先输出362,然后8800,知道了这点,那么求n的阶乘最后一个非0的数就变得很简单了。。只要加个while判断一下,就ok了、、#include#include#include#includeusing name

2013-04-05 16:48:42 8171 7

原创 zoj 3332-Strange Country II-dfs

DescriptionYou want to visit a strange country. There are n cities in the country. Cities are numbered from 1 to n. The unique way to travel in the country is taking planes. Strangely, in this str

2013-04-05 16:39:38 1673

原创 poj -2560-Freckles-最小生成树

In an episode of the Dick Van Dyke show, little Richie connects the freckles on his Dad's back to form a picture of the Liberty Bell. Alas, one of the freckles turns out to be a scar, so his Ripley'

2013-04-05 16:18:25 2028

原创 hdu-1394-逆序数

又有一段时间没怎么写博客了。是不是连这么点时间也要节约。。额。。所谓的逆序数就是前面的数比后面的要大,在一个排列中,所有逆序数的总和就是这个排序的逆序数比如: 2  3 4 1,逆序数有 21,,31,41,所以逆序数就是3关键是怎么求出n个数的逆序数:1.先求出中的逆序数2.每次把最后面的往前调,逆序数减少 n - 1 - a[i], 增加 a[i];详见代码:

2013-04-05 10:16:49 1107

原创 zju-Gift?!-dfs

题目的意思很简单:青蛙要到指定的岩石拿礼物,前提是:   1.必须从岩石1出发  2.以后的每一次,第(i)次,要么往前 2 * i - 1步,要么往后2 *  i  - 1 步 3.要是在跳的过程中,跳到了河的左岸或者是右岸,那么游戏结束,意味着青蛙拿不到礼物了代码要注意的地方: 1.因为要满足第一次跳的是到第一块岩石,怎么满足这个条件了???  --------

2013-04-04 22:26:11 641

原创 poj- 1321-棋子问题-dfs

算是水题吧。。简单的dfs搜索:题目:给出不规则的棋盘,#表示棋盘区域,然后在上面摆放棋子,问你有几种放法#include #include using namespace std;const int maxn = 8;char MAP[maxn][maxn];int n, k, cnt;bool vis[maxn];void dfs(int x, int cur){

2013-04-04 10:53:03 584

空空如也

空空如也

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

TA关注的人

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