Question: 1.please write your code in c 2.your code will be judged by the loader code 3.please make sure to pass the test cases Days of
1.please write your code in c
2.your code will be judged by the loader code
3.please make sure to pass the test cases
Days of heavy rain in November caused many mudslides in the mountains of northern Taiwan. In order to reduce the disaster of mudslides, the students of the research institute want to develop an application that can detect the impact area of mudslides. On a 5 * 5 map, Dikes are marked as 1, flat land as 0, and buildings as 2. In the beginning, there will be a starting position of a mudslide, and then it will impact up, down, left, and right through this point, and it will stop when it encounters a dike. Please write a program to give a map and the starting position, so that you can know how many houses have been impacted by mudslides. For example, here is a map
0 1 0 1 2
0 1 2 1 1
0 1 0 0 2
2 0 1 0 0
2 2 0 1 0
The upper left corner of the map is (0,0). The mudslide starts from (0, 2), and it will stop when it encounters the dike of 1, so it will rush to the 2 buildings (1,2) and (2, 4) in the end.
Input
0 2
0 1 0 1 2
0 1 2 1 1
0 1 0 0 2
2 0 1 0 0
2 2 0 1 0
Output
2
Example 1
Input
0 2
0 1 0 1 2
0 1 2 1 1
0 1 0 0 2
2 0 1 0 0
2 2 0 1 0
Output
2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
