fb pixel

Snake

You’ve decided to create the game Snake. To do that the first task you decide to tackle is to fill the whole field with a snake - that would be the maximum possible score in the game.
Given two integers h and w, your program should print the field filled with the path of the snake.
notion image
Input
4 10

Output
0  1  2  3  4  5  6  7  8  9
19 18 17 16 15 14 13 12 11 10
20 21 22 23 24 25 26 27 28 29
39 38 37 36 35 34 33 32 31 30
 
To check your solution you need to sign in
Sign in to continue