기출 문제 / 삼성 2020 Second Half Afternoon Problem 1

Cleaning is Fun

You are given an n×n matrix representing the amount of dust on the floor. The value of n is always odd, and initially, there is no dust at the exact center of the grid. Starting from the center, you will clean the floor in a spiral pattern as shown in the image below.