Editorial for COCI '16 Contest 2 #4 Prosječni
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
The task can be solved in a lot of different ways.
One of the possible solutions is the following:
- In the first row, we write down the numbers .
- Each following row but the last is obtained by adding to each number from the previous row.
- The last row is obtained in the following way: For each column, if the numbers are the numbers written in that column so far, we write the number in the row in that column. By doing this, we achieved that the average of that column is equal to the next to last number in the column.
The only thing left is to make sure that the average of the last row is in that row. We leave this as an exercise for the reader to prove that the average is equal to the number in the last row and the next to last column.
Comments