Problem list
Log in
#r03100 · Online Judge > GoldOJ

Linear Search

Bronze III 2.0 s 256 MB

A set of $n$ distinct integers (in arbitrary order) is given, then a target $k$. Print the 1-based position of $k$ in input order, or -1 if $k$ is not present.

Input

Line 1: $n$. Line 2: $n$ distinct integers. Line 3: the target $k$.

Output

Print the 1-based position of $k$, or -1.

Example 1

Input
8
5 2 15 1 11 3 9 7
11
Output
5

Example 2

Input
3
5 2 7
3
Output
-1
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code