DWITE Online Computer Programming Contest
May 2010
Problem 3
Oil Spill Area
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 file DATA3.txt will contain 5 sets of input, each a 10x10 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 file OUT3.txt will contain 5 lines of output, integers 1 <= N <= 100 -- area of corresponding oil globes.
Note: only up/down and left/right adjacent cells are connected. Diagonals are not.
Sample Input (first two shown):
.......... .##....... ...#...... ....###... ....#A#... ....###... .......... .......... .......... .......... ========== .......... ...######. ...#....#. ...#.##.#. ...##A#.#. ........#. .......##. .......... ##........ ##........ ==========
Sample Output (first two shown):
9 20