問題一覧 > 通常問題

No.2091 Shio Ramen (Easy)

レベル : / AI推定難易度 : 109 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 98
作問者 : tohohogisu / テスター : 👑 箱星
お気に入りにしたユーザー ProblemId : 8590 / 自分の提出
問題文最終更新日: 2022-10-05 17:18:05
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original

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もしくは右上の雲マークをクリックしてアカウントを作成してください。