CF996B.World Cup
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Allen wants to enter a fan zone that occupies a round square and has n entrances.
There already is a queue of ai people in front of the i-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute.
Allen uses the following strategy to enter the fan zone:
- Initially he stands in the end of the queue in front of the first entrance.
- Each minute, if he is not allowed into the fan zone during the minute (meaning he is not the first in the queue), he leaves the current queue and stands in the end of the queue of the next entrance (or the first entrance if he leaves the last entrance).
Determine the entrance through which Allen will finally enter the fan zone.
艾伦想要进入一个占据圆形广场的球迷区,该球迷区共有 n 个入口。
第 i 个入口前已排有 ai 个人的队伍。每个入口每分钟允许其队列中的一个人进入球迷区。
艾伦采用以下策略进入球迷区:
- 初始时,他站在第一个入口前队伍的末尾。
- 每分钟,如果他在该分钟内未被允许进入球迷区(即他不是队列中的第一个人),他就离开当前队列,并站到下一个入口队列的末尾(若他离开的是最后一个入口,则下一个入口为第一个入口)。
请确定艾伦最终进入球迷区时所通过的入口编号。
输入格式
The first line contains a single integer n (2≤n≤105) — the number of entrances.
The second line contains n integers a1,a2,…,an (0≤ai≤109) — the number of people in queues. These numbers do not include Allen.
第一行包含一个整数 n(2≤n≤105)—— 表示入口的数量。
第二行包含 n 个整数 a1,a2,…,an(0≤ai≤109)—— 表示各队列中的人数。这些数字不包括 Allen。
输出格式
Print a single integer — the number of entrance that Allen will use.
输出一个整数——Allen 将使用的入口编号。
输入输出样例
输入#1
4 2 3 2 0
输出#1
3
输入#2
2 10 10
输出#2
1
输入#3
6 5 2 6 5 7 4
输出#3
6
说明/提示
In the first example the number of people (not including Allen) changes as follows: [2,3,2,0]→[1,2,1,0]→[0,1,0,0]. The number in bold is the queue Alles stands in. We see that he will enter the fan zone through the third entrance.
In the second example the number of people (not including Allen) changes as follows: [10,10]→[9,9]→[8,8]→[7,7]→[6,6]→[5,5]→[4,4]→[3,3]→[2,2]→[1,1]→[0,0].
In the third example the number of people (not including Allen) changes as follows: [5,2,6,5,7,4]→[4,1,5,4,6,3]→[3,0,4,3,5,2]→[2,0,3,2,4,1]→[1,0,2,1,3,0]→[0,0,1,0,2,0].
在第一个例子中,人数(不包括艾伦)的变化过程如下:[2,3,2,0]→[1,2,1,0]→[0,1,0,0]。加粗的数字表示艾伦当前所在的队列。可以看出,他将通过第三个入口进入球迷区。
在第二个例子中,人数(不包括艾伦)的变化过程如下:[10,10]→[9,9]→[8,8]→[7,7]→[6,6]→[5,5]→[4,4]→[3,3]→[2,2]→[1,1]→[0,0]。
在第三个例子中,人数(不包括艾伦)的变化过程如下:[5,2,6,5,7,4]→[4,1,5,4,6,3]→[3,0,4,3,5,2]→[2,0,3,2,4,1]→[1,0,2,1,3,0]→[0,0,1,0,2,0]。
输入解题思路,AI测评打分。不知道怎么写?