Buying A House

题意翻译

## 题目描述 ### Zane从未如此疯狂的爱上一位姑娘。 姑娘的房子是村子里的第 $m$ 个房子。村子里一共有 $n$ 个房子。他们分别是房子 $1$ 号,房子 $2$ 号 ………… 房子 $n$ 号。村子规划得十分整齐,每一个房子之间都隔着 $10$ 米。这个村子里面,有的已经被买了,有的则是闲置着的,这些闲置着的就可以购买。 Zane 十分想要与这位美丽的姑娘住在一起,但姑娘怕他的父母发现,于是 Zane 只能住在他的附近。 Zane 手头只有 $k$ 元钱,他想要知道自己与这位住的可以多近。 ## 输入格式 第一行为 $n$, $m$, $k$。分别为房子的数量,姑娘的房子的位置,Zane 手头有多少钱。 接下来的一行有 $n$ 个数,第 $i$ 个数代表第 $i$ 个房子的标价。如果为 $0$ 则代表着个房子已经被购买了。(姑娘的房子的标价也是 $0$)。 ## 输出格式 Zane 会购买一个离姑娘的家最近的一个房子,请输出这个房子离姑娘的家的距离。 ## 说明 第一个样例中 Zane 可以购买第 $5$ 个房子,这样离姑娘最近。 第二个样例中 Zane 可以购买第 $6$ 个房子,这样里姑娘最近。 第三个样例中 Zane 可以购买第 $3$ 个房子,这样离姑娘最近。 感谢@Black_white_tony 提供的翻译

题目描述

Zane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF796A/8aa573b8462c0371d723b29bc703ceb564b7d8af.png)The girl lives in house $ m $ of a village. There are $ n $ houses in that village, lining in a straight line from left to right: house $ 1 $ , house $ 2 $ , ..., house $ n $ . The village is also well-structured: house $ i $ and house $ i+1 $ ( $ 1<=i&lt;n $ ) are exactly $ 10 $ meters away. In this village, some houses are occupied, and some are not. Indeed, unoccupied houses can be purchased. You will be given $ n $ integers $ a_{1},a_{2},...,a_{n} $ that denote the availability and the prices of the houses. If house $ i $ is occupied, and therefore cannot be bought, then $ a_{i} $ equals $ 0 $ . Otherwise, house $ i $ can be bought, and $ a_{i} $ represents the money required to buy it, in dollars. As Zane has only $ k $ dollars to spare, it becomes a challenge for him to choose the house to purchase, so that he could live as near as possible to his crush. Help Zane determine the minimum distance from his crush's house to some house he can afford, to help him succeed in his love.

输入输出格式

输入格式


The first line contains three integers $ n $ , $ m $ , and $ k $ ( $ 2<=n<=100 $ , $ 1<=m<=n $ , $ 1<=k<=100 $ ) — the number of houses in the village, the house where the girl lives, and the amount of money Zane has (in dollars), respectively. The second line contains $ n $ integers $ a_{1},a_{2},...,a_{n} $ ( $ 0<=a_{i}<=100 $ ) — denoting the availability and the prices of the houses. It is guaranteed that $ a_{m}=0 $ and that it is possible to purchase some house with no more than $ k $ dollars.

输出格式


Print one integer — the minimum distance, in meters, from the house where the girl Zane likes lives to the house Zane can buy.

输入输出样例

输入样例 #1

5 1 20
0 27 32 21 19

输出样例 #1

40

输入样例 #2

7 3 50
62 0 0 0 99 33 22

输出样例 #2

30

输入样例 #3

10 5 100
1 0 1 0 0 0 0 0 1 1

输出样例 #3

20

说明

In the first sample, with $ k=20 $ dollars, Zane can buy only house $ 5 $ . The distance from house $ m=1 $ to house $ 5 $ is $ 10+10+10+10=40 $ meters. In the second sample, Zane can buy houses $ 6 $ and $ 7 $ . It is better to buy house $ 6 $ than house $ 7 $ , since house $ m=3 $ and house $ 6 $ are only $ 30 $ meters away, while house $ m=3 $ and house $ 7 $ are $ 40 $ meters away.