Question
Garden (use only c language) You have a garden of size N N. Each cell of the garden has a value vij which represents the
Garden (use only c language) You have a garden of size N N. Each cell of the garden has a value vij which represents the fertility of the cell. However, the maintenance cost of your garden is so high that you need to sell some cells of your land. You decided to keep a portion of your land of size M M which has the maximum fertility sum. In short, you need to determine the maximum fertility sum of all possible sub-rectangles of size M M! Format Input The first line consists of an integer N, the size of your garden. The next N lines each consists of N integers vij which represents the fertility value of cell (i, j). The last line of input consists of a single integer M, the size of the sub-rectangle. Format Output Output a single integer X which is the maximum fertility sum of all possible sub- rectangles of size M M. Constraints 2 N 100 1 M < N 0 vi,j 109 Sample Input 1 (standard input) 3 3 1 0 2 4 0 4 1 3 2 Sample Output 1 (standard output) 11 Sample Input 2 (standard input) 2 0 1 1 0 1 Sample Output 2 (standard output) 1
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