Pro.ID22704 TitleSnatch! Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22704 AC0 Submit0 Ratio- 时间&空间限制描述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. 输入Input data contains 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. 输出Description 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. Input Input data contains 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. Output Output one line. It contains the technological code. The numbers in this line should be separated by one or more spaces. Sample Input 2 10 Sample Output 1 6 Source 样例输入2 10 样例输出1 6 作者 |