当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2156:National Day Celebration

题目描述
It is 100 years since the country was founded, and the king decides to hold an activity, which is described below, to celebrate this National Day. The king and N soldiers make up a circle, and from a random chosen man, the N+1 persons are numbered from 1 to N+1 (the mans numbered with i and i+1 (1 <= i <= N) are neighboring, and the man numbered with N+1 is adjacent to the man numbered with 1). Then count M people from the man numbered with 1, and have the M-th person get out of the circle. This kind of operation continues, and every time the counting starts from the person who is right after the person going out in the last term.
The king declares that the person going out in the K-th term will gain a lot of money. The king is eager to know who will be the lucky person and when he will go out. He asks you to make a program to tell him.
输入解释
A single line of input contains four integers N, M, K, J (1 <= M, N <= 10000000, 1 <= K <= 20000, 1 <= K <= N+1, 1 <= J <= N+1). N, M and K have the same meaning as described above, and J is the king’s number.
输出解释
The output contains two integers in one line separated by a space. The first integer represents the number of person who will gain the money, and the second integer represents in which term the king will go out.
输入样例
10 3 5 8
输出样例
5 9

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 POJ Monthly,Loger

源链接: POJ-2156

最后修改于 2020-10-29T06:25:03+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 65536