当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
The company Supersafe produces a safe with a combination lock. The lock of this safe consists of N cylinders on a common axis. Each cylinder revolves on this axis independently of other cylinders. The are numbers from 1 to M in a circle on each cylinder. At any time, one of these numbers is visible in a special window on the door of the safe. Thus it is possible to enter numbers by rotating the cylinders. Accordingly, the code of the safe is a sequence of N numbers, each number belonging to the interval from 1 to M.
As a rule, such safes have a mechanism for opening them in the case the code is forgotten or lost. For this model, the mechanism has two components:
The process of opening the safe is as follows. The specialist enters the technological code (not allowing the owner to see the code, of course), puts in the key, and then turns all cylinders until – click – the safe unlocks. After that, the specialist takes out the key and mixes up the obtained code by entering random numbers on all the cylinders.
You want to open one of such safes without the owner’s knowledge. For this purpose, you have obtained a copy of the safe key and found out that:
It remains to determine the technological code.
The input contains a single line with the values N and M. Both numbers are integers, belong to the interval from 2 to 20000 and are separated from each other by one or more spaces.
The output also consists of one line. It contains the technological code. The numbers in this line should be separated by one or more spaces.
2 10
1 6
时间上限 | 内存上限 |
1000 | 65536 |