Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.please write your code in c 2. your code will be judged by loader code 3. make sure to pass the test case Days of

1.please write your code in c

2. your code will be judged by loader code

3. make sure to pass the test case

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.

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions

Question

List and comment on the six stages of TDWIs BI maturity framework.

Answered: 1 week ago

Question

4. What advice would you give to Carol Sullivan-Diaz?

Answered: 1 week ago