自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

/

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

转载 C++文件读写总结,做USACO碰到问题,找到一篇比较全面的

在C++中如何实现文件的读写?一、ASCII 输出为了使用下面的方法, 你必须包含头文件(译者注:在标准C++中,已经使用取代,所有的C++标准头文件都是无后缀的。)。这是 的一个扩展集, 提供有缓冲的文件输入输出操作. 事实上, 已经被包含了, 所以你不必包含所有这两个文件, 如果你想显式包含他们,那随便你。我们从文件操作类的设计开始, 我会讲解如何进行ASCII I/O操作。

2012-12-14 20:17:11 1508

原创 POJ3258,River Hopscotch,二分加贪心

River HopscotchDescriptionEvery year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement takes place o

2012-12-01 22:37:41 607

原创 POJ1062,昂贵的聘礼,中文题,Dijkstral

昂贵的聘礼Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球

2012-12-01 21:55:31 691

原创 POJ1860,Currency Exchange,最近懒死了啊,,,

Currency ExchangeDescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations o

2012-12-01 21:15:32 684

原创 POJ1797,Heavy Transportation,貌似是最大流什么的,有点特殊,所以拿Kruskal练练手

Heavy TransportationDescriptionBackground Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether ther

2012-11-27 12:28:14 579

原创 POJ1258,Agri-Net,明显的最小生成树

Agri-NetDescriptionFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs your help, of course. Fa

2012-11-25 19:38:22 468

原创 POJ2485,Highways,最小生成树继续Prim

HighwaysDescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware o

2012-11-25 19:29:41 498

原创 POJ1789,Truck History,最小生成树,Prim

Truck HistoryDescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own c

2012-11-25 19:05:50 1086

原创 POJ2394,Checking an Alibi,Dijkstra单源最短路

Checking an AlibiDescriptionA crime has been comitted: a load of grain has been taken from the barn by one of FJ's cows. FJ is trying to determine which of his C (1 <= C <= 100) cows is the cu

2012-11-25 18:22:26 905

原创 最小生成树,Prim,Kruskal算法主要思想,证明及C++实现

最小生成树:任何只由G的边构成,并包含G的所有顶点的树称为G的生成树(G连通).加权无向图G的生成树的代价是该生成树的所有边的代码(权)的和.最小代价生成树是其所有生成树中代价最小的生成树。实现最小生成树的算法常用的是Prim,Kruskal学校数据结构的书上讲解了这两大算法的思路及用C++实现,但关于其合理性的证明却略过去了,这里主要加上我自己的一些总结,证明一下,最后写个模版用。P

2012-11-24 22:00:07 9331

原创 POJ1207,The 3n + 1 problem,水输出要注意...

The 3n + 1 problemDescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyz

2012-11-19 21:30:52 567

原创 POJ2606,Rabbit hunt,同斜率,照抄1118

Rabbit huntDescriptionA good hunter kills two rabbits with one shot. Of course, it can be easily done since for any two points we can always draw a line containing the both. But killing three

2012-11-19 21:27:46 529

原创 POJ1046,Color Me Less,心情不爽就去切水

Color Me LessDescriptionA color reduction is a mapping from a set of discrete colors to a smaller one. The solution to this problem requires that you perform just such a mapping in a standard

2012-11-19 21:24:52 686

原创 POJ2251,Dungeon Master,三维bfs水,切起来很爽

Dungeon MasterDescriptionYou 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 min

2012-11-10 19:39:29 581

原创 POJ3414,Pots,隐式图搜索

PotsDescriptionYou are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i)        fill the pot i (1 ≤ i ≤ 2) from the tap;DR

2012-11-10 19:27:56 492

原创 POJ3087,Shuffle'm Up,有人说这是bfs...

Shuffle'm UpDescriptionA 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, ea

2012-11-10 18:38:51 826

原创 POJ3126,Prime Path,想漏了一点,坑了好久

Prime PathDescriptionThe 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 off

2012-11-10 18:13:59 559

原创 POJ1426,Find The Multiple,bfs...注意类型 5兆内存过了...

Find The MultipleDescriptionGiven 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

2012-11-10 18:03:36 1242

原创 POJ3278,Catch That Cow,BFS...

Catch That CowDescriptionFarmer 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 c

2012-11-10 17:55:01 565

原创 POJ1321,棋盘问题,中文题

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

2012-11-07 21:25:08 574

原创 hduoj1010,Tempter of the Bone,持续dfs剪枝剪枝

Tempter of the BoneProblem DescriptionThe 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

2012-11-07 20:12:37 388

原创 hduoj1239,Calling Extraterrestrial Intelligence Again,搜索以及剪枝

Calling Extraterrestrial Intelligence AgainProblem DescriptionA message from humans to extraterrestrial intelligence was sent through the Arecibo radio telescope in Puerto Rico on the afternoon of

2012-11-07 19:24:22 517

原创 hduoj1238,Substrings,搜索,练习string的使用

SubstringsProblem DescriptionYou are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse can be found as a substring

2012-11-07 19:07:34 630

原创 POJ3030,Nasty Hacks,每天早上水一题有益身心健康

Nasty HacksDescriptionYou are the CEO of Nasty Hacks Inc., a company that creates small pieces of malicious software which teenagers may use to fool their friends. The company has just finis

2012-11-07 18:26:21 531

原创 POJ3009,Curling 2.0,冰球2.0同样dfs,话说搜索是我用调试器最多的

Curling 2.0DescriptionOn Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board

2012-11-07 18:21:14 428

原创 POJ2488,A Knight's Journey,DFS脑子快抽筋了这几天我会乱说?

A Knight's JourneyDescriptionBackground The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever

2012-11-07 18:10:37 635

原创 POJ1026,Cipher,数学题

CipherDescriptionBob and Alice started to use a brand-new encoding scheme. Surprisingly it is not a Public Key Cryptosystem, but their encoding and decoding is based on secret keys. They c

2012-11-04 18:48:35 626

原创 POJ1090,生日蛋糕,dfs,经典的剪枝

生日蛋糕Description7月17日是Mr.W的生日,ACM-THU为此要制作一个体积为Nπ的M层生日蛋糕,每层都是一个圆柱体。 设从下往上数第i(1 Ri+1且Hi > Hi+1。 由于要在蛋糕上抹奶油,为尽可能节约经费,我们希望蛋糕外表面(最下一层的下底面除外)的面积Q最小。 令Q = Sπ 请编程对给出的N和M,找出蛋糕的制作方案(适当的Ri和Hi的值)

2012-11-04 11:28:19 1153

原创 数据结构实验,哈夫曼编码/译码系统

1. 实验名称: 二叉树的基本操作及哈夫曼编码译码系统的实现 2.实验目的:创建一棵二叉树,实现先序、中序和后序遍历一棵二叉树,计算二叉树结点个数等操作。哈夫曼编码/译码系统。 3. 实验任务:       能成功演示二叉树的有关运算,运算完毕后能成功释放二叉树所有结点占用的系统内存。 4. 实验内容  (1)在二叉链表上实现二叉树运算a)        设

2012-11-02 22:45:55 10306

原创 POJ1562,Oil Deposits,dfs+bfs,这几天有做东西,没写博客= =

Oil DepositsDescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and

2012-11-02 22:36:09 645

原创 POJ2993,Emag eht htiw Em Pleh,跟2996反过来

Emag eht htiw Em PlehDescriptionThis problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the corresponding input.Inputaccord

2012-10-27 19:40:07 574

原创 POJ2996,Help Me with the Game,棋盘模拟,同水且繁

Help Me with the GameDescriptionYour task is to read a picture of a chessboard position and print it in the chess notation.InputThe input consists of an ASCII-art picture of a chessboard

2012-10-27 19:23:29 663

原创 POJ1573,Robot Motion,模拟水题,繁

Robot MotionDescriptionA robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible inst

2012-10-27 19:17:39 597

原创 POJ2632,Crashing Robots,模拟法,繁

Crashing RobotsDescriptionIn a modernized warehouse, robots are used to fetch the goods. Careful planning is needed to ensure that the robots reach their destinations without crashing into eac

2012-10-25 13:37:55 714

原创 POJ1068,Parencodings,模拟题,但用的是数学规律

ParencodingsDescriptionLet S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: q By an integer sequence P = p1 p2...pn where pi is the number of lef

2012-10-25 12:46:35 495

原创 POJ3295,Tautology,看到分类是构造法吓住了,主要是递归

TautologyDescriptionWFF 'N PROOF is a logic game played with dice. Each die has six faces representing some subset of the possible symbols K, A, N, C, E, p, q, r, s, t. A Well-formed formula (

2012-10-23 11:44:02 793

原创 POJ1118,Lining Up,暴力过的,hash什么的只能仰慕

Lining UpDescription"How am I ever going to solve this problem?" said the pilot. Indeed, the pilot was not facing an easy task. She had to drop packages at specific points scattered in a dange

2012-10-21 19:25:33 632

原创 POJ1111,Image Perimeters,典型dfs,跟八连块差不多

Image PerimetersDescriptionTechnicians in a pathology lab analyze digitized images of slides. Objects on a slide are selected for analysis by a mouse click on the object. The perimeter of the

2012-10-21 19:11:58 586

原创 POJ1723,SOLDIERS,纯数学,猜想+证明

SOLDIERSDescriptionN soldiers of the land Gridland are randomly scattered around the country. A position in Gridland is given by a pair (x,y) of integer coordinates. Soldiers can move - in one

2012-10-20 22:51:24 753

原创 POJ1694,An Old Stone Game,读懂题目+dfs

An Old Stone GameDescriptionThere is an old stone game, played on an arbitrary general tree T. The goal is to put one stone on the root of T observing the following rules: At the beginning of

2012-10-20 15:19:53 595

空空如也

空空如也

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

TA关注的人

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