HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Problems from Olympiads.ru > problem:


133. 50239 - Eating cheese

Guest
• Discussion of problem (1)

Volume problems

• 107b. 50242 - Numbers whose sum...
• 113. 50241 - Greatest common divisor
• 127b. 50730 - The largest product
• 127c. 50731 - The largest product (2)
• 138. 50732 - Sorting
• 147. 50251 - Symmetric matrix
• 213. 50769 - Arithmetic expression
• 217. 50253 - Timer
• 133. 50239 - Eating cheese
• 159. 50668 - Triangle
• 206. 50252 - Birthday
• 234. 50249 - Ladders
• 235. 50250 - The Knight
• 272. 50707 - Rebus
• 240. 50247 - Missing numbers
• 275. 50691 - The traveling salesma...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Difficulty Beta

There is a piece of cheese in a rectangle with the size of N x M . Poor little mouse wants to eat the entire cheese. Starting at an arbitrary cell, he is eating regular slices (1x1) of cheese, and then passes to the next (Only if it has not eaten). Help small little mouse to draw the route such that he eats all the cheese.

Input
In the first line the numbers N and M is given. (1 <= N , M <= 30).
Output
Withdraw the route as a sequence of a mouse coordinates pieces, which he eats. Slices of cheese are the coordinates of 1 to N on the X, from 1 to M on Y axis.

Input
2 2
Output
1 1
2 1
2 2
1 2

Для отправки решений необходимо выполнить вход.

www.contester.ru