HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Unsorted > problem:


50239 - Eating cheese

Guest
• Discussion of problem (1)

Section problems

• 51104 - Steel
• 51113 - The Menu
• 51112 - Even Numbers
• 51105 - Currency System
• 51103 - Is it a triangle?
• 51114 - The traveling vehicle
• 50251 - Symmetric matrix
• 50252 - Birthday
• 50239 - Eating cheese
• 50244 - Chessboard Pattern
• 50245 - Santa Gifts
• 50256 - Sequence
• 50257 - Galls village
• 50280 - Division
• 50266 - Kovrov
• 50254 - Lawyers Council
• 50260 - What about judges?

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