随笔分类 -  查找||DFS||BFS

摘要:http://poj.org/problem?id=2907Collecting BeepersTime Limit:1000MSMemory Limit:65536KDescriptionKarel is a robot who lives in a rectangular coordinate system where each place is designated by a set of integer coordinates (xandy). Your job is to design a program that will help Karel pick up a number o 阅读全文

posted @ 2011-01-20 12:28 yming0221 阅读(164) 评论(0) 推荐(0)

摘要:http://poj.org/problem?id=1111Image PerimetersTime Limit:1000MSMemory Limit:10000KDescriptionTechnicians 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 boundary of an object is one useful measur 阅读全文

posted @ 2011-01-18 20:19 yming0221 阅读(186) 评论(0) 推荐(0)

摘要:最近刚刚学习回溯算法,标记一下,体会回溯的内涵http://poj.org/problem?id=1321棋盘问题Time Limit: 1000MSMemory Limit: 10000KDescription在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= 阅读全文

posted @ 2011-01-17 18:58 yming0221 阅读(163) 评论(0) 推荐(0)

摘要:http://poj.org/problem?id=3626Mud PuddlesTime Limit:1000MSMemory Limit:65536KDescriptionFarmer John is leaving his house promptly at 6 AM for his daily milking of Bessie. However, the previous evening saw a heavy rain, and the fields are quite muddy. FJ starts at the point (0, 0) in the coordinate p 阅读全文

posted @ 2011-01-11 20:42 yming0221 阅读(164) 评论(0) 推荐(0)

摘要:http://poj.org/problem?id=3051Satellite PhotographsTime Limit:1000MSMemory Limit:65536KDescriptionFarmer John purchased satellite photos of W x H pixels of his farm (1 <= W <= 80, 1 <= H <= 1000) and wishes to determine the largest 'contiguous' (connected) pasture. Pastures are c 阅读全文

posted @ 2011-01-06 14:07 yming0221 阅读(138) 评论(0) 推荐(0)

摘要:本题就是求一个数是否能写成几个数的阶乘的和的形式,可以当作背包问题,也可以用DFS来解,下面用的贪心http://poj.org/problem?id=1775Sum of FactorialsTime Limit:1000MSMemory Limit:30000KDescriptionJohn von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contributions to the foundations of mathemati 阅读全文

posted @ 2010-12-23 13:38 yming0221 阅读(230) 评论(0) 推荐(0)

摘要:http://poj.org/problem?id=2386简单DFS搜索Lake CountingTime Limit:1000MSMemory Limit:65536KDescriptionDue 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 e 阅读全文

posted @ 2010-12-23 11:09 yming0221 阅读(140) 评论(0) 推荐(0)

摘要:刚刚看到我还以为是就是简单排序呢,总是WA然后又使用二进制枚举,不过二进制还不太熟悉,用的将十进制计算转换成二进制,然后计算,总是TLE,记录一下,练习练习位操作最后看到了递归的方法当然本题属于背包问题,可以用DP解决标记,学习了!/* Author : yan * Question : POJ 3628 Bookshelf 2 * Data && Time : Wednesday, December 22 2010 11:34 PM*/#include<stdio.h>int cow[20];int b;int n;int ans=99999999;void DF 阅读全文

posted @ 2010-12-23 07:20 yming0221 阅读(158) 评论(0) 推荐(0)

摘要:http://poj.org/problem?id=3126我的第一道BFS,WA了几次,TLE了几次,最后AC!Prime PathTime Limit:1000MSMemory Limit:65536KTotal Submissions:5022Accepted:2908DescriptionThe 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 阅读全文

posted @ 2010-12-20 17:32 yming0221 阅读(150) 评论(0) 推荐(0)

摘要:该题的大体意思是,有几个广播站,相邻的广播站不同用相同的颜色实际就是着色问题,这里着色的是边的着色Channel AllocationTime Limit:1000MSMemory Limit:10000KTotal Submissions:7070Accepted:3606DescriptionWhen a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a strong signal. Ho 阅读全文

posted @ 2010-12-19 20:22 yming0221 阅读(144) 评论(0) 推荐(0)

摘要:一看到该题就认为可以用最长公共子序列来解于是写了一下,提交显示MLE,改成循环数组又WA,不知道哪里问题看到别人的解法,感觉思维方式很特别,很好,循环长串指针,比较长串和短串的一位,如果相等,短串指针加一最后判断一下短串的指针有没有指到最后,如果移动到最后就说明查长串包含短串,否则.....也提醒一下自己的思维定势All in AllTime Limit:1000MSMemory Limit:30000KTotal Submissions:17955Accepted:7127DescriptionYou have devised a new encryption technique which 阅读全文

posted @ 2010-12-18 20:09 yming0221 阅读(114) 评论(0) 推荐(0)

摘要:该题主要是简单的模拟,用递归实现可以用一个二维数组存储走到i,j位置时,所经历的步数DescriptionA 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 instructions areN north (up the page)S south (down the page)E east (to the right on 阅读全文

posted @ 2010-12-15 21:15 yming0221 阅读(146) 评论(0) 推荐(0)

摘要:本题使用记忆话递归即可,也可以用动态规划DP不过得使用三维数组,空间复杂度比较高Function Run FunTime Limit:1000MSMemory Limit:10000DescriptionWe all love recursion! Don't we?Consider a three-parameter recursive function w(a, b, c):if a <= 0 or b <= 0 or c <= 0, then w(a, b, c) returns:1if a > 20 or b > 20 or c > 20, 阅读全文

posted @ 2010-12-15 21:04 yming0221 阅读(150) 评论(0) 推荐(0)

摘要:BabelfishTime Limit:3000MSMemory Limit:65536KTotal Submissions:17068Accepted:7376DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.InputInput consists of 阅读全文

posted @ 2010-12-04 17:55 yming0221 阅读(138) 评论(0) 推荐(0)

摘要:Oil DepositsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 6282Accepted: 3557DescriptionThe 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 阅读全文

posted @ 2010-11-19 08:45 yming0221 阅读(126) 评论(0) 推荐(0)

导航