A Civil Architect is working on a plan of residential independent houses in a private society. The vic square meter, the area may differ from site to site, as given in the below image: 10 6 5 8 11 7 3 9 8 4 3 2 7 9 4 2 CH Now they want to demolish some illegally constructed buildings diagonally. For every diagonal destruction, some cost is involved. So the civil architect wants to sum up the entire cost of destroying of all diagonals in the reverse diagonal sequence. Constraint: 0

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Please code the question in c or c++ or java or python or R or javascript ( any one of the following)
A Civil Architect is working on a plan of residential independent houses in a private society. The ty iss
square meter, the area may differ from site to site, as given in the below image:
10
Deloi
11
7
5
3
8 9
6
9
4
2
4
8
3
7
2
Constraint:
0<S<150
oryCh
Now they want to demolish some illegally constructed buildings diagonally. For every diagonal destruction, some cost is involved. So the civil architect wants to
sum up the entire cost of destroying of all diagonals in the reverse diagonal sequence.
▷
square in shape. Each site has a total area calculated in
If the cost of destruction of each square flat is provided in the form of the matrix, Write a program that calculates the total cost of destruction of all the diagonals
of the matrix.
CH65
Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings while reading the input or while printing, as these contribute to the
standard output.
Input Format:
The first line of input contains an integer, S, the size of the society.
The next S line of input contains S site areas each separated by a single white space.
Sample Input1:
3
123
456
789
Output Format:
The output should contain the total cost of destruction of all diagonals in the reverse diagonal sequence, each separated by a single white space. Print the cost of
destruction from diagonals from top left corner to the bottom right corner.
Transcribed Image Text:A Civil Architect is working on a plan of residential independent houses in a private society. The ty iss square meter, the area may differ from site to site, as given in the below image: 10 Deloi 11 7 5 3 8 9 6 9 4 2 4 8 3 7 2 Constraint: 0<S<150 oryCh Now they want to demolish some illegally constructed buildings diagonally. For every diagonal destruction, some cost is involved. So the civil architect wants to sum up the entire cost of destroying of all diagonals in the reverse diagonal sequence. ▷ square in shape. Each site has a total area calculated in If the cost of destruction of each square flat is provided in the form of the matrix, Write a program that calculates the total cost of destruction of all the diagonals of the matrix. CH65 Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings while reading the input or while printing, as these contribute to the standard output. Input Format: The first line of input contains an integer, S, the size of the society. The next S line of input contains S site areas each separated by a single white space. Sample Input1: 3 123 456 789 Output Format: The output should contain the total cost of destruction of all diagonals in the reverse diagonal sequence, each separated by a single white space. Print the cost of destruction from diagonals from top left corner to the bottom right corner.
Sample Output 7:3
1615149
Explanation1:
Here, total size of the society is 3.
So, the total cost of destruction in reverse diagonal sequence are 1, (2+4), (3+5+7), (6+8) 9
Deloite
Therefore, it will print 1, 6, 15, 14, and 9 as an output
Sample Input 2:
4
1234
5678
9 10 11 12
13 14 15 16
Sample Output 2:
17 18 34 33 27 16
C1165335
Defoin
Therefore, it will print 1, 7, 18, 34, 33, 27, and 16 as an output
viso
Explanation 2:
Here, the total size of the society is 4.
So, the total cost of destruction in reverse diagonal sequence are 1, (2+5), (3+6+9), (4+7+10+13), (8+11+14), (12+15), and 16.
Transcribed Image Text:Sample Output 7:3 1615149 Explanation1: Here, total size of the society is 3. So, the total cost of destruction in reverse diagonal sequence are 1, (2+4), (3+5+7), (6+8) 9 Deloite Therefore, it will print 1, 6, 15, 14, and 9 as an output Sample Input 2: 4 1234 5678 9 10 11 12 13 14 15 16 Sample Output 2: 17 18 34 33 27 16 C1165335 Defoin Therefore, it will print 1, 7, 18, 34, 33, 27, and 16 as an output viso Explanation 2: Here, the total size of the society is 4. So, the total cost of destruction in reverse diagonal sequence are 1, (2+5), (3+6+9), (4+7+10+13), (8+11+14), (12+15), and 16.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY