自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Coldfresh的博客

keeeeeep!~

  • 博客(21)
  • 收藏
  • 关注

原创 Fibonacci (POJ - 3070 )(矩阵快速幂)

In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …An alternative fo

2017-04-29 14:42:07 408

原创 Blocks (POJ - 3734)(矩阵快速幂)

Panda has received an assignment of painting a line of blocks. Since Panda is such an intelligent boy, he starts to think of a math problem of painting. Suppose there are N blocks in a line and each bl

2017-04-29 14:32:06 1067

原创 K-th Number (POJ - 2104 )(平方分割)

You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quick

2017-04-27 11:25:32 420

原创 Crane(POJ-2991)(线段树)

ACM has bought a new crane (crane – jeřáb) . The crane consists of n segments of various lengths, connected by flexible joints. The end of the i-th segment is joined to the beginning of the i + 1-th on

2017-04-26 14:39:35 710

原创 翻转问题(对于线性结构)

其实是有这类题型的,不多也不少,也不能说有特定的一种算法,但是有其一类非常巧妙的技巧,今天好好研究了一下,用一道题来引入Face The Right Way POJ - 3276 Farmer John has arranged his N (1 ≤ N ≤ 5,000) cows in a row and many of them are facing forward, like good co

2017-04-24 12:14:02 593

原创 Jessica's Reading Problem POJ - 3320 (尺取法)

Jessica’s a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on it. If she wants to pass it, she has to master all ideas inclu

2017-04-23 16:20:49 500

原创 Subsequence POJ - 3061 (二分法和尺取法两种做法)

A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subs

2017-04-23 14:43:19 434

原创 二分法搜索的应用

二分法是一个应用比较广泛的算法,但是也因此往往被我们忽略,比如这蓝桥杯的倒数第二题,我忽略了线性枚举的超时的可能性,也竟然忘了用二分法(所幸还是进了决赛…)以防万一使用二分会保险一点,今天之所以要将这个,是因为在poj上做到了几道相似的题,所以我觉得有必要总结一下,用三道例题阐述一下:Cable master POJ - 1064 Inhabitants of the Wonderland hav

2017-04-23 12:10:26 522

原创 哈密顿绕行世界问题 (HDU - 2181 )(DFS)

一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发的城市。 Input 前20行的第i行有3个数,表示与第i个城市相邻的3个城市.第20行以后每行有1个数m,m<=20,m>=1.m=0退出. Output 输出从第m个城市出发经过每个城市1次又回到m的所有路线,如有多条路线,按字典序输出,每行1条路线.每行首先输出是第几条路

2017-04-22 11:49:19 293

原创 eight(hdu-1043)(待修正)

The 15-puzzle has been around for over 100 years; even if you don’t know it by that name, you’ve seen it. It is constructed with 15 sliding tiles, each with a number from 1 to 15 on it, and all packed

2017-04-20 19:01:55 404

原创 Pots (POJ - 3414 )(BFS)

BFS

2017-04-19 00:44:37 495

原创 Prime Path (POJ - 3126) (BFS)

BFS

2017-04-18 22:49:56 472

原创 Dungeon Master (POJ - 2251 )(三维BFS)

You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south,

2017-04-17 21:50:00 321

原创 棋盘问题(dfs)(poj-1321)

在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n 当为-

2017-04-17 20:50:18 491

原创 You Are the One(区间dp)(fromHDU)

dp

2017-04-17 15:09:07 347

原创 男神的礼物(区间dp变式)

动态规划

2017-04-17 11:02:23 507

原创 最长回文(manacher算法)(fromHDU)

给出一个只由小写英文字符a,b,c…y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如aba, abba等 Input 输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c…y,z组成的字符串S 两组case之间由空行隔开(该空行不用处理) 字符串长度len <= 110000 Output 每一行一个整数x,对应一组case,

2017-04-15 11:22:32 354

原创 S-Nim(fromHDU)(博弈问题)(Sprague-Grundy定理)

题目描述: Arthur and his sister Caroll have been playing a game called Nim for some time now. Nim is played as follows: The starting position has a number of heaps, all containing some, not necessarily eq

2017-04-07 23:32:31 904

原创 危险系数(又名:风险度量)(并查集)

问题描述 抗日战争时期,冀中平原的地道战曾发挥重要作用。地道的多个站点间有通道连接,形成了庞大的网络。但也有隐患,当敌人发现了某个站点后,其它站点间可能因此会失去联系。我们来定义一个危险系数DF(x,y):对于两个站点x和y (x != y), 如果能找到一个站点z,当z被敌人破坏后,x和y不连通,那么我们称z为关于x,y的关键点。相应的,对于任意一对站点x和y,危险系数DF(x,y)就表示为这两

2017-04-07 00:32:43 1324

原创 网络寻路(深搜)

问题描述 X 国的一个网络使用若干条线路连接若干个节点。节点间的通信是双向的。某重要数据包,为了安全起见,必须恰好被转发两次到达目的地。该包可能在任意一个节点产生,我们需要知道该网络中一共有多少种不同的转发路径。源地址和目标地址可以相同,但中间节点必须不同。如下图所示的网络。1 -> 2 -> 3 -> 1 是允许的1 -> 2 -> 1 -> 2 或者 1 -> 2 -> 3 -> 2 都是非法

2017-04-05 14:53:12 573

原创 操作格子(线段树)

线段树

2017-04-04 13:29:29 290

空空如也

空空如也

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

TA关注的人

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