Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write code Tushar really enjoys working with 2.D anays and is always looking for new ways to work with the array data. Triditional uses

Please write code
image text in transcribed
Tushar really enjoys working with 2.D anays and is always looking for new ways to work with the array data. Triditional uses typically involve horizontal and vertical processing but Tustar is trying a diagonal pattern and is having some difficulty. Starting at the top left comer. which is indexed as row 0 and column 0 , work down and right to compute the average of the. elements along a diagonal. Then, work across the top to generate an average for each down and right diagonal. Continue by working down the left side and generate an average, again moving down and right along each diagonat. In the above example with 5 rows and 6 columns, the first shaded diagonal contains 1..5, the second diagonal 610, the third shaded diagonial 1114, the fourth diagonal 15,17, the fifth shaded diagonal 1819, and finishing across the top with just 20. Working down the left side would be 21.24, then shaded 25.27, then 28..29, and finally just the shaded 30 . This produces 10 diagonals with averages shown in sample output below. Input: First line contains a single integer N the number of test cases that follow with N10. Each test case starts with a line containing 2 integers separated by whitespace: R, the number of rows, and C, the number of columns, with both 2R,C12. That line will be followed by R lines of data with each containing C integers separated by whitespace containing integers in [ 100,100]. Output: For each test ense, output 1 row of averages, separated by single spaces. Display the averages with 2 digits after the decimal point. Sample input: sample output: 3.008.0012.5016.0018.5020.0022.5026.0028.5030.008.506.003.501.0011.0013.5016.003.006.003.003.00

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

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions

Question

50. Prove the result in the second proposition, MaXb (t) ebtMX(at).

Answered: 1 week ago

Question

b. Explain how you initially felt about the communication.

Answered: 1 week ago

Question

3. Identify the methods used within each of the three approaches.

Answered: 1 week ago

Question

a. When did your ancestors come to the United States?

Answered: 1 week ago