Source: http://poj.org/problem? Id = 2386
Lake counting
Time limit:1000 ms
Memory limit:65536 K
Total submissions:20124
Accepted:10139
DescriptionDue to recent rains, water has pooled in varous places in Farmer John's field, which is represented by a rectangle of N x m (1 Given a distriof Farmer John's field, determine how he ponds he has.Input* Lin
There is a garden of N * m in size, which accumulates water after rain. The water in the eight connections is considered to be connected together, and the total number of water troughs in the garden is determined (the eight connections are relative to the W * Part ).
***
* W *
***
Analysis: Starting from any W, the adjacent part is replaced. After one DFS operation, all the WS connected to the initial W are replaced with '.', that is, the Wa disappears. So until the graph does not contain W, th
HTTP://ACM.CSU.EDU.CN/ONLINEJUDGE/PROBLEM.PHP?ID=1014 (Topic link)Test instructionsFrom one point to the other, you can walk, take a bus or play, different modes of transportation spend different money, of course, the time spent is different. The shortest time from the beginning S to the end point T in case the total amount of money spent is less than L.SolutionShould yzc the invitation to do this problem, is a hierarchical map of the shortest way, transfer a bit disgusting.DetailsNote that init
POJ 2386 Lake Counting search question, poj2386
Simple Deep Search is enough. When someone says what to use and query the set, it is a small use of big algorithms.
Because it can be searched in depth without backtracking, the efficiency is O (N * M.
The trick is to add a sign P. Every time a pond is searched, there is a W letter, so it is considered that a pond is searched, and the P value is true.
Do not repeat the searched pond. Therefore, every tim
Lake counting
Time limit:1000 ms
Memory limit:65536 K
Total submissions:19591
Accepted:9848
DescriptionDue to recent rains, water has pooled in varous places in Farmer John's field, which is represented by a rectangle of N x m (1
Given a distriof Farmer John's field, determine how he ponds he has.
Input* Line 1: two space-separated integers: N and m
* Lines 2 .. n + 1: m characters per line representing one row
Screenwriter: HermeticalStarring: Chen Xiao/Chen YanEver seen in the mother version of the Oriental unbeaten (Jon) will be particularly fond of this role, feel that the protagonist is proud of the Jon, so that Fox Chong is only a supporting role.
The statue of God is a lot of places have some mishap, is an individual to arrange a love for you,, Huangdao master and Ouyang Fung afraid is also drunk ...Feel the intriguing place:
Yang from the young debauchery to 16 years after the mature
Matrix of the N*mW is water. It's the ground.Ask how many ponds there areThe definition of a pond is:W is connected in eight directions into a piece counted as a pondIn the sample input, there are three pieces of the upper left, lower left, and right side connected together WSo the sample output gives the answer to 3 ponds#include #include#defineN 110using namespacestd;intn,m;CharS[n][n];voidDfsintXinty) {S[x][y]='.'; inti,j; for(i=-1; i1; i++) for(j=-1; j1; J + +) { i
Sky system. The engine provides several primitives, including a soft real-time scheduler and a hierarchial, Retained-mode graphics sys TEM, that's let you build high-quality apps. The Sky framework. The framework makes it easy-to-build apps using Sky by providing familiar user interface widgets, such as buttons, Infinit e lists, and animations, on top of the engine using Dart. These extensible components follow a functional programming style inspired by React.In a nutshell,Sky engine is a graph
Have you ever seen a chess booth in the streets? Do you also want to try your skills, but always afraid to win two retreat, small made for you to tidy up a few common pieces, and marked the corresponding nameHongyan Double FlyMinor Levy EastEarthworm Descending DragonMustang FieldSeven Stars PartyWild Goose lineup turned outKing of mud and horse crossingA probe into the mother of four francsLittle Second ArtilleryStrap into the faceLittle Five RatsFire and even campSunny PhoenixGrand Levy WestCr
[Poj 2386] Lake Counting, poj2386
DescriptionDue to recent rains, water has pooled in varous places in Farmer John's field, which is represented by a rectangle of N x M (1
Given a distriof Farmer John's field, determine how he ponds he has.
Input* Line 1: Two space-separated integers: N and M
* Lines 2 .. N + 1: M characters per line representing one row of Farmer John's field. each character is either 'W' or '. '. the characters do not have spaces
In a forum, many people found that in the second battle of the Korean War, the number of casualties between China and the United States and the victory or defeat of the battle were detected. It's speechless. Since figures have been officially published, the exact number of casualties may be more meaningful to the historian-restoring history to its original face.
This is the key battle in the Second Five battles of the North Korean War. The 20, 27, 26 of the 9 th army of our army, and the First
Chinese Times reporter that Nokia's new mobile phone is more reasonable in terms of resources. Android system has an ecological chain, supply chain research and development with the help of Foxconn, brand sales force in Nokia, positioning 3000 yuan or so in the middle-end or can support live.Jindi also to the "Huaxia Times" reporter said, Nokia after the return of the product strategy is to enter the high-end. At present, mobile phone market high-end competition saturation, the middle end has a
replaced for each matching string.5.1 Methods for executing external commands within VIMInput:! The external command can then be executed immediately after entering an external command.For example,:!ls + ENTER, which is the listing of the contents of your current directory.5.2 More information about saving filesTo save changes to a file, enter: W file name.5.3 A Selective Save commandYou can save the selected content to the destination file by pressing the V key to select a portion of the file
The materials used in this tutorial are common and are very easy to find. But the author after a simple rendering and decoration, the picture has a qualitative leap. The overall feeling is very dreamy, beautiful. Well worth studying.Final effect
1, new document 500x500 Pixel, background white, open the lake material, drag into the document, zoom position as follows.
What is the river, for the big nails in the chess world, the lake is a matrix, his goal is to ride a horse in the rivers and lakes, from his position to go to the end.
Of course, the big nailed horse also obeys the Chinese chess "The horse Goes Day" the rule, and in the matrix, there will be some obstacles, the horse can not jump to the obstacles, if the big nails in front of the horse is a barrier, that is, "horse legs", then he will not be able to j
Description Due to recent rains, water have pooled in various places in Farmer John ' s field, which was represented by a rect Angle of N x m (1 Given a diagram of Farmer John ' s field, determine how many ponds he had.
Input * Line 1:two space-separated integers:n and M* Lines 2..n+1:m characters per line representing one row of Farmer John ' s field. Each character is either ' W ' or '. '. The characters does not have spaces between them.
Output * Line 1:the number of ponds in Farmer John ' s
Title: Artificial LakeDescribe:"Title description"There is a lake, surrounded by cities, and each city is connected to only two cities adjacent to him. Suppose there are N cities, numbered 1-n, highways are bidirectional, highways are sometimes good, sometimes bad, and now ask you whether two cities can reach each other."Input Format"The first row is two numbers, one 2"Output Format"For each f=1 query, the output "YES" can be reached, otherwise the ou
Laifeng Ancient station, the river is not clear, fish thinThe Diaojiaolou of a 12-year-old bunThe dust flew on the bridge, and flew into the window of the grandmother.I have a tray of bunsLying at three o'clock in the morning, the pillow is the monthThe dream is scattered on the road, like falling night SakuraFather and mother said, the lake is waiting for meSo I melted the old station.Poured into every hair of mine, the blood tubes and the hairs.When
you do, not clear, I then cut you. RAID card slowly: To say that my raid card family in the lake is also famous, all martial arts gangs will have us such a weapon, you see Dell, IBM, HP three gates sent each home has our RAID card figure, although martial arts moves some differences, but we play a role is crucial, We provide you with the disk of the server insured escort, the common protection method has RAID0/RAID1/RAID5, based on your old 3 hard di
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.