自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

海绵的博客

竞赛虐我千百遍,我待竞赛如初恋。 Never Give Up!!!

  • 博客(57)
  • 问答 (8)
  • 收藏
  • 关注

转载 深度理解链式前向星

转载自:http://blog.csdn.net/acdreamers/article/details/16902023版权声明:本文为博主原创文章,未经博主允许不得转载。我们首先来看一下什么是前向星.前向星是一种特殊的边集数组,我们把边集数组中的每一条边按照起点从小到大排序,如果起点相同就按照终点从小到大排序,并记录下以某个点为起点的所有边在数组中的起始位置和存储长度,那么前向星就构造好了.用le

2017-07-31 21:38:15 183

原创 The Festive Evening

time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It’s the end of July – the ti

2017-07-31 14:11:06 183

原创 The Tag Game

Alice got tired of playing the tag game by the usual rules so she offered Bob a little modification to it. Now the game should be played on an undirected rooted tree of n vertices. Vertex 1 is the root

2017-07-31 08:35:29 221

原创 Garland

Once at New Year Dima had a dream in which he was presented a fairy garland. A garland is a set of lamps, some pairs of which are connected by wires. Dima remembered that each two lamps in the garland

2017-07-31 08:32:27 420

原创 Sudoku

Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. The other

2017-07-30 09:58:26 239

原创 Shuffle'm Up

A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, each stack containing C chips. Eac

2017-07-30 09:47:39 158

原创 Find The Multiple

Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there

2017-07-30 09:43:56 155

原创 生日蛋糕

Total Submissions: 20118 Accepted: 7160Description 7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。 设从下往上数第i(1 <= i <= M)层蛋糕是半径为Ri, 高度为Hi的圆柱。当i < M时,要求Ri > Ri+1且Hi > Hi+1。...

2017-07-30 09:37:38 475

原创 哈密顿绕行世界问题

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

2017-07-30 09:33:59 638

原创 棋盘问题***

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

2017-07-30 09:25:37 161

转载 各种数据类型的取值范围

速查表:char -128 ~ +127 (1 Byte) short -32767 ~ + 32768 (2 Bytes) unsigned short 0 ~ 65536 (2 Bytes) int -2147483648 ~ +2147483647 (4 Bytes) unsigned int 0 ~ 4294967295 (4 Bytes) long == int long l

2017-07-29 14:28:54 941

原创 Prime Ring Problem

A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Note: the number of fi...

2017-07-29 09:49:52 514

原创 Find a way

Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home is at the coun

2017-07-29 09:40:58 278

原创 非常可乐

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

2017-07-29 09:36:58 1093 1

原创 Fire Game

Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start

2017-07-29 09:27:28 169

原创 Tempter of the Bone

The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone w

2017-07-28 10:19:17 165

原创 Dungeon Master

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-07-28 10:07:16 163

原创 Prime Path

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 secu

2017-07-28 10:03:48 657

原创 Pots

题目链接这个题一开始也是蒙,直到最短路就是BFS(),但是怎样同时保存下两点的状态,自己一下子就不会了,更不用说怎么标记了。看到题解才恍然大悟,原来他是用坐标,进行记录两点在某一时刻的状态,在用二维数组进行标记状态,发现这宗思路简直太666了//这个题将访问过的点看作坐标,正好本来也100*2的点数组还是能开出来的//刚才没有思路在不知道怎样同时考虑两个杯子的水量,他们是关联的//还不能知道,是

2017-07-28 09:46:56 621

原创 Fire!

题目链接讲真,一开始没有思路的,想着同时进行根本没有办法,进行模拟。看了别人的题解,瞬间明白了,先进性预处理,这样的话,我们就可以标记下每个点被燃烧的时间点,这样只要在这个时间点前到达的话,就可以走到这个点。两次BFS(),感觉真是太奇妙了。还有坑点,就是这地方有草,但是可能烧不到,一定要注意这种情况,就是标记能不能烧到#include<stdio.h>#include<string.h>#in

2017-07-28 09:42:34 651

原创 二叉树的遍历

给出一棵二叉树的中序和前序遍历,输出它的后序遍历。Input本题有多组数据,输入处理到文件结束。每组数据的第一行包括一个整数n,表示这棵二叉树一共有n个节点。接下来的一行每行包括n个整数,表示这棵树的中序遍历。接下来的一行每行包括n个整数,表示这棵树的前序遍历。3<= n <= 100 Output 每组输出包括一行,表示这棵树的后序遍历。 Sample Input 7

2017-07-27 12:41:37 214

原创 10305 - Ordering Tasks

题目链接 简单的队列#include<stdio.h>#include<cstring>#include<queue>using namespace std;const int Max=101;//队列也是可以的int Map[Max][Max];int in_degree[Max];int main(){ int n,m; while(~scanf("%d%d",&n

2017-07-27 10:59:16 266

原创 Maze

Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side.Pav

2017-07-27 10:06:48 509

原创 Heap Operations

Petya has recently learned data structure named "Binary heap".The heap he is now operating with allows the following operations: put the given number into the heap; get the value of the minimum

2017-07-27 10:04:06 323

原创 The Suspects

Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to se

2017-07-27 10:01:23 189

原创 Passing the Message

What a sunny day! Let’s go picnic and have barbecue! Today, all kids in “Sun Flower” kindergarten are prepared to have an excursion. Before kicking off, teacher Liu tells them to stand in a row. Teache

2017-07-27 10:00:30 481

原创 迷宫问题

定义一个二维数组: int maze[5][5] = {0, 1, 0, 0, 0,0, 1, 0, 1, 0,0, 0, 0, 0, 0,0, 1, 1, 1, 0,0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。 Input 一个5 × 5的二维数组,表示一个迷宫。数据保证有唯一

2017-07-26 08:11:51 267

原创 确定比赛名次

有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。 Input 输入有若干组,每组中的第一行为二个数N(1<=N<=500),M;其中N表示队伍的个数,M表示接着有

2017-07-26 08:01:13 2664 1

原创 Catch That Cow

Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,00

2017-07-26 07:47:55 202

原创 Oil Deposits ( 简单搜索,连通性)

The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the

2017-07-26 07:44:27 423

原创 Sereja ans Anagrams(map)

What a sunny day! Let’s go picnic and have barbecue! Today, all kids in “Sun Flower” kindergarten are prepared to have an excursion. Before kicking off, teacher Liu tells them to stand in a row. Teache

2017-07-26 07:39:07 310

原创 Arpa’s obvious problem and Mehrdad’s terrible solution

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-07-25 10:21:01 160

原创 Stones

Because of the wrong status of the bicycle, Sempr begin to walk east to west every morning and walk back every evening. Walking may cause a little tired, so Sempr always play some games this time.Ther

2017-07-25 10:19:20 224

原创 Windows Message Queue

Message queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something happens to this process, such as mouse click, text change, the system will

2017-07-25 10:17:11 183

原创 Wireless Network

An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the ne

2017-07-25 10:14:09 403

原创 Largest Submatrix of All 1’s

Given a m-by-n (0,1)-matrix, of all its submatrices of all 1’s which is the largest? By largest we mean that the submatrix has the most elements.InputThe input contains multiple test cases. Each test

2017-07-25 10:11:22 270

原创 Alternative Thinking

Kevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's sco

2017-07-25 10:10:03 322

原创 Knight Tournament

Hooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all knights in the kingdom and they in turn agreed to participate in this grand event.As for

2017-07-25 10:07:38 458

原创 How Many Tables

Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, an

2017-07-25 10:05:47 190

原创 最高的奖励

有N个任务,每个任务有一个最晚结束时间以及一个对应的奖励。在结束时间之前完成该任务,就可以获得对应的奖励。完成每一个任务所需的时间都是1个单位时间。有时候完成所有任务是不可能的,因为时间上可能会有冲突,这需要你来取舍。求能够获得的最高奖励。Input 第1行:一个数N,表示任务的数量(2 <= N <= 50000) 第2 - N + 1行,每行2个数,中间用空格分隔,表示任务

2017-07-25 10:03:09 278

空空如也

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

TA关注的人

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