这个问题是约瑟夫问题的一个变种,可以用线段树解决。
This problem is a variant of the Josephus problem which can be solved with segment tree.
大意:排队买票问题,后面来的总是把原来的人替换掉,并且使得原来的人往后移,让你顺序输出他们代表的编号,用线段树来记录空格数。
For each test cases, output a single line of space-separated integers which are the values of people in the order they stand in the queue.
大意:排队买票问题,后面来的总是把原来的人替换掉,并且使得原来的人往后移,让你顺序输出他们代表的编号,用线段树来记录空格数。
For each test cases, output a single line of space-separated integers which are the values of people in the order they stand in the queue.
应用推荐