Question
C Programming Language Problem Title: Komodo National Park Do You know that Komodo National Park, located in Nusa Tenggara Timur (NTT), is a World Heritage
C Programming Language
Problem Title: Komodo National Park
Do You know that Komodo National Park, located in Nusa Tenggara Timur (NTT), is a World Heritage Site by UNESCO, the specialized agency under United Nations (UN).
One day, Lili and Bibi were on vacation on one of the islands in the Komodo National
Park area and they just realized that they were living alone on that island because the cot- tage owner was completing his unfinished business on the main island. We all know that
Komodo, as the endemic island, live in this archipelago. Lili is very worried, and won- dering is there a barrier between the komodos on the island and their cottage. Lili once
read an article that said that when there is no food supply, komodos can prey on humans.
You, as the person who took Lili and Bibi to the island, are trying to whether the con- ditions are safe for them to live on the island or not.
The map contains several characters that described the island with the cottage. You may assume that the island can fit in the map and the map always in rectangular form. The characters inside the map are described below. S - indicates sea that surround the island. You may assume that all area outside the map is always ocean area. H - is the location of the cottage that Lili and Bibi want to stay. It is guaranteed that there is only one cottage in the island. K - indicates the position of all komodos in the island. Komodo is able to move north, west, south, and east. Komodos in the island also quite lazy to swim or even touch the water.
F - is the secure barrier between the komodos and the islands visitor. L - is the empty area inside the island.
Help Lili and Bibi to make sure their own security and safety from the dangerous Komodo. You need to count how many dangerous Komodo as their threats. If it is not safe for them, they should leave the island as soon as possible.
Format Input
Input consists of one integer T - number of test case. For every test case, two integers follow - N and M - number of rows and columns on the map. Then, N lines follow. Those N lines contain M characters for each line. All characters have been explained above.
Format Output
Output should be expressed in format Case #X: Y - X is the number of test case, and followed by Y - number of Komodo that should be secured from them.
Constraints
1 T 1000 1 N 100 1 M 100
Sample Input & Output (standard input & output)
2
3 3
SSS
SHS
KSS
Case #1: 0
4 5
SKKKS
SKKKS
SSHSS
SSSSS
Case #2: 6
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started