Editorial for COCI '22 Contest 5 #1 Kalendar
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.
We can create an array consisting of zeroes, the integers from to , and then, if necessary, some more zeroes, so that the length of the array is divisible by . The zeroes represent the missing days, i.e. the ones we will replace with ...
.
The length of this array divided by is the number of rows the calendar will have. We can now iterate through the array and create the rows: depending on the element of the arrays, we will determine which three characters should we add.
The above described solution is without decorations. We can add them easily: the first and last row are always the same, and all the other rows can be made with a little addition to the solution from above.
Comments