DWITE '09 R7 #3 - Oil Spill Area

View as PDF

Submit solution

Points: 7
Time limit: 1.0s
Memory limit: 64M

Problem type
DWITE Online Computer Programming Contest, May 2010, Problem 3

We want to measure globes of the oil spills, by calculating their area from satellite images. There could be multiple disconnected globes in a single image, so the area of interest is marked.

The input will contain 5 test cases, each a 10 \times 10 grid. Each set is followed by a line of 10 = signs, to visually break up test cases.

  • # — oil spill
  • . — water
  • A — marks the area of interest

The output will contain 5 lines, integers 1 \le N \le 100 — area of corresponding oil globes.

Note: only up/down and left/right adjacent cells are connected. Diagonals are not.

Sample Input

..........
.##.......
...#......
....###...
....#A#...
....###...
..........
..........
..........
..........
==========
..........
...######.
...#....#.
...#.##.#.
...##A#.#.
........#.
.......##.
..........
##........
##........
==========

Sample Output

9
20

Problem Resource: DWITE

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

Comments

There are no comments at the moment.