文件名称:1-3
介绍说明--下载内容来自于网络,使用问题请自行百度
描述
某公司在对应聘者做过一轮笔试之后,从中选出n 人继续进行面试,每位应聘者被分配了一个整数ID。
为公平起见,组织者决定利用会议室外的圆桌,按以下方法“随机”确定面试顺序:第一个到达的应聘者在圆桌周围任意选择一个位置坐下;此后到达的每位应聘者都从前一应聘者出发,沿逆时针方向围圆桌走过m 人(前一应聘者算作走过的第1 人,同一人可能经过多次),并紧邻第m 人右侧就座;所有应聘者到齐后,从最后到达者出发,绕圆桌以顺时针方向为序进行面试。
这里假定应聘者到达的时刻互异,且相对的就坐位置确定后,左、右两人之间总能插入一把椅子。
试编写一个程序,确定面试顺序。
输入
共2行。
第1行包含两个整数, n和m。
第2行包含n个整数,表示先后到达的n个应聘者的ID。
输出
共1行。以空格分隔的n个整数,分别表示顺次进行面试的应聘者的ID。(After a company has done a written test of the candidate, n people are selected to continue the interview. Each candidate is assigned an integer ID.
To be fair, the organizers decided to use the round table outside the conference room to "randomly" determine the interview sequence as follows: The first candidate who arrives at a random place around the round table sits down; each candidate arrives thereafter Candidates starting from the round table counterclockwise around m people (the previous candidate counted as walking through the first person, the same person may go through many times), and the m-th right seat; all candidates to Qi, starting from the last arrivals, around the round table in order to conduct an interview in the clockwise direction.
Here assume that candidates arrive at different times, and the relative seating position is determined, the left and right can always insert a chair between the two.)
某公司在对应聘者做过一轮笔试之后,从中选出n 人继续进行面试,每位应聘者被分配了一个整数ID。
为公平起见,组织者决定利用会议室外的圆桌,按以下方法“随机”确定面试顺序:第一个到达的应聘者在圆桌周围任意选择一个位置坐下;此后到达的每位应聘者都从前一应聘者出发,沿逆时针方向围圆桌走过m 人(前一应聘者算作走过的第1 人,同一人可能经过多次),并紧邻第m 人右侧就座;所有应聘者到齐后,从最后到达者出发,绕圆桌以顺时针方向为序进行面试。
这里假定应聘者到达的时刻互异,且相对的就坐位置确定后,左、右两人之间总能插入一把椅子。
试编写一个程序,确定面试顺序。
输入
共2行。
第1行包含两个整数, n和m。
第2行包含n个整数,表示先后到达的n个应聘者的ID。
输出
共1行。以空格分隔的n个整数,分别表示顺次进行面试的应聘者的ID。(After a company has done a written test of the candidate, n people are selected to continue the interview. Each candidate is assigned an integer ID.
To be fair, the organizers decided to use the round table outside the conference room to "randomly" determine the interview sequence as follows: The first candidate who arrives at a random place around the round table sits down; each candidate arrives thereafter Candidates starting from the round table counterclockwise around m people (the previous candidate counted as walking through the first person, the same person may go through many times), and the m-th right seat; all candidates to Qi, starting from the last arrivals, around the round table in order to conduct an interview in the clockwise direction.
Here assume that candidates arrive at different times, and the relative seating position is determined, the left and right can always insert a chair between the two.)
相关搜索: 循环链表
(系统自动生成,下载前可以参看下载内容)
下载文件列表
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.