CF120B.Quiz League
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the question. All it takes to answer a typical question is general knowledge and common logic. The question sent be the audience are in envelops lain out in a circle on a round table. Each envelop is marked by the name of the asker's town. Each question is positioned in a separate sector. In the centre of the table is a spinning arrow. Thus, the table rather resembles a roulette table with no ball but with a spinning arrow instead. The host sets off the spinning arrow to choose a question for the experts: when the arrow stops spinning, the question it is pointing at is chosen. If the arrow points at the question that has already been asked, the host chooses the next unanswered question in the clockwise direction. Your task is to determine which will be the number of the next asked question if the arrow points at sector number k.
一个名为“什么?哪里??何时??”的团队问答游戏在贝尔兰非常流行。该游戏围绕两支队伍之间的竞赛展开:一支是由六名专家组成的专家队,另一支是观众队。一名观众提出一个问题,专家们有一分钟的时间进行头脑风暴并找出该问题的正确答案。回答一个典型问题仅需基本常识和普通逻辑即可。观众提出的问题被装入信封,并按环形排列在一张圆桌上。每个信封上都标有提问者所在城市的名称。每个问题占据一个独立的扇区。圆桌中心设有一个可旋转的指针。因此,这张桌子很像一张没有小球、但装有旋转指针的轮盘赌桌。主持人启动指针旋转以随机选择一个问题供专家作答:当指针停止旋转后,其所指向的问题即被选中。如果指针指向的扇区所对应的问题已经被问过,则主持人将顺时针方向选择下一个尚未被问过的问题。你的任务是:若指针最终停在编号为 k 的扇区上,请确定下一个将被提出的问题的编号。
输入格式
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: a__i = 0 if the question from sector i has already been asked and a__i = 1 if the question from sector i hasn't been asked yet (1 ≤ i ≤ n). The sectors are given in the clockwise order, the first sector follows after the n-th one.
第一行包含两个正整数 n 和 k(1 ≤ n ≤ 1000 且 1 ≤ k ≤ n)—— 分别表示圆盘上的扇区数量以及箭头当前所指的扇区编号。
第二行包含 n 个数字:若扇区 i 的问题已被提问过,则 ai=0;若扇区 i 的问题尚未被提问,则 ai=1(1 ≤ i ≤ n)。
扇区按顺时针顺序给出,第 1 个扇区紧接在第 n 个扇区之后。
输出格式
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
输出一个数字——即专家将被提问的问题所在的扇区编号。保证答案存在,即并非所有问题都已被提问过。
输入输出样例
输入#1
5 5 0 1 0 1 0
输出#1
2
输入#2
2 1 1 1
输出#2
1
输入解题思路,AI测评打分。不知道怎么写?