| Problem ID | 1108 |
|---|---|
| Title | Islands in Flatland |
| Description | Flatland is very strange. It is flat, and it is made of grids. We can view the world of Flatland as H x W grids. Each grid is either ocean or land. We say two land grid is connected if they share an common edge. A island is a connected component of lands. Find the number of islands in Flatland. |
| Input | The first line contains 2 integers H and W (1 ≤ H, W ≤ 100), the height and the width of Flatland. The following H lines each contains W characters, where '.' represent ocean and '*' represent land. |
| Output | A single integer, the number of islands. |
| Sample Input | 6 6 ...**. ....*. .*.... ..*.*. ..*.*. ..***. |
| Sample Output | 3 |
| Hint | BFS/DFS |
| Last Modified | 2012-06-04 14:25:32 |
| Time Limit | 1 seconds |
| Memory Limit | 32 MB |
| Accepted Solutions | 0 |
| Submitted Solutions | 0 |
| Difficulty Factor | 200 |
Facebook