书山有径勤为路>>>>>>>>

<<<<<<<<学海无涯苦作舟!

2011年9月23日

STL之stack——解决POJ 1028

摘要: DescributionStandard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be reached by moving backward and forward. In this problem, you are asked to implement this. 阅读全文

posted @ 2011-09-23 22:45 More study needed. 阅读(214) 评论(0) 推荐(0) 编辑

BFS解决POJ 2243

摘要: DescriptionYou 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, east, west, up or down. You cannot move diagonally and the maze is surrounded by solid 阅读全文

posted @ 2011-09-23 22:40 More study needed. 阅读(209) 评论(0) 推荐(0) 编辑

DFS解决POJ 1979

摘要: DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can move only on black tiles. Write a program to count the nu 阅读全文

posted @ 2011-09-23 22:38 More study needed. 阅读(146) 评论(0) 推荐(0) 编辑

BFS解决POJ 2386

摘要: DescriptionDue to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W') or dry land ('.'). Farmer John would like to figure 阅读全文

posted @ 2011-09-23 22:37 More study needed. 阅读(199) 评论(0) 推荐(0) 编辑

DFS解决POJ 2386

摘要: DescriptionDue to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 100) squares. Each square contains either water ('W') or dry land ('.'). Farmer John would like to figure 阅读全文

posted @ 2011-09-23 22:35 More study needed. 阅读(151) 评论(0) 推荐(0) 编辑

BFS解决POJ 2251

摘要: DescriptionYou 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, east, west, up or down. You cannot move diagonally and the maze is surrounded by solid 阅读全文

posted @ 2011-09-23 22:34 More study needed. 阅读(182) 评论(0) 推荐(0) 编辑

动态规划解决POJ 3624

摘要: 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 charm i in the supplied list has a weightWi (1 ≤ Wi ≤ 400), a 'desirability' factor Di ( 阅读全文

posted @ 2011-09-23 22:23 More study needed. 阅读(223) 评论(0) 推荐(0) 编辑

一道简单但是经典的动态规划题

摘要: 描述 打败万恶的ghost以后,将军准备回寝室告诉大伙儿这个消息,没想到杯具又发生了… 你知道有种鬼叫路鬼吗?让人莫名其妙的迷路,将军就被这种鬼上身了。将军本来要上楼梯的,但是因为鬼上身,他要不就上一层楼,要不就下一层楼,这个是随机的,他不能控制自己啦! 假设将军住在第M楼,因为体力原因,将军只能上或者下N次楼,刚开始将军在K楼,假设东6宿舍共有100层。现在问当体力消耗完的时候,将军刚好回到寝室那一层有多少种可能。 例如:将军住在5楼,将军的能上/下5次楼,现在在1楼, 那么将军将回不到寝室啦,为什么?我也不知道。 输入有多组测试数据,每组测试数据共一行,为M,N,K(0 < N &l 阅读全文

posted @ 2011-09-23 22:22 More study needed. 阅读(288) 评论(0) 推荐(0) 编辑

Kruskal算法解决POJ 1861

摘要: 题目:http://poj.org/problem?id=1861说下题意,给出节点个数m和边数n,下面n行给出边(x,y)以及权值w。输出第一行为最小生成树中的最大边权值,第二行为一个可行生成树方案的边数k,下面k行为可行生成树的k条边。题目是Special Judge,意思就是不具有唯一解,可能有多解,样例输出为以下结果也可算对。131 32 42 3一样按照Kruskal解题即可,结果虽然不唯一,但是最小生成树一定是可行解之一。将边加入生成树时记录最大权值和边信息然后输出即可。View Code #include "iostream"#include "al 阅读全文

posted @ 2011-09-23 22:17 More study needed. 阅读(281) 评论(0) 推荐(0) 编辑

CSS设置字体——声声明多属性

摘要: 1 <html> 2 <head> 3 <style type="text/css"> 4 p.ex1 5 { 6 font:italic arial,sans-serif; 7 } 8 9 p.ex210 {11 font:italic bold 12px/30px arial,sans-serif;12 }13 </style>14 </head>15 16 <body>17 <p class="ex1">18 This is a paragraph. This is 阅读全文

posted @ 2011-09-23 20:57 More study needed. 阅读(279) 评论(0) 推荐(0) 编辑

导航

书山有径勤为路>>>>>>>>

<<<<<<<<学海无涯苦作舟!