No.2091 Shio Ramen (Easy)
タグ : / 解いたユーザー数 98
作問者 :
Problem Statement
Taro likes shio (salt) ramen. However, Taro is particular about it, so he only likes shio ramen whose saltiness differs from \(S\) by at most \(K\).
In the town where Taro lives, there are \(N\) shio ramen shops, and the shio ramen sold by shop\(_i\) has saltiness \(A_i\). (\(1 \leq i \leq N\))
Taro buys a shio ramen that he likes. However, if there are multiple such shio ramen, Taro buys the one whose saltiness has the smallest difference from \(S\).
Output the number \(R\) of the shop selling the shio ramen that Taro buys. However, if no such ramen exists, output Unlucky!.
Also, if there are multiple shio ramen whose saltiness has the smallest difference from \(S\), output the smallest number among them.
Input
\(N\) \(S\) \(K\) \(A_1\) \(A_2\) \(\vdots\) \(A_N\)
Constraints
\(1 \leq N,S \leq 10\)
\(0 \leq K \leq 10\)
\(1 \leq A_i \leq 10\) (\(1 \leq i \leq N\))
All inputs are integers.
Output
\(R\)
Sample
Sample 1
Input
5 5 1 2 5 6 7 9
Output
2
Taro likes the 2nd shio ramen the most.
Sample 2
Input
5 10 3 1 2 3 4 5
Output
Unlucky!
Sample 3
Input
5 5 1 3 6 4 9 7
Output
2
If there are multiple shio ramen whose saltiness has the smallest difference from \(S\), output the smallest number among them.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。