#C3969. Element Search in an Array
Element Search in an Array
Element Search in an Array
In this problem, you are given an array of integers (A = [a_1, a_2, \ldots, a_n]) and an integer (X). Your task is to determine whether (X) exists in the array. If it exists, print True
; otherwise, print False
.
Input/Output Requirements:
- The input is read from standard input (stdin).
- The output is written to standard output (stdout).
Example:
Input: 5 1 2 3 4 5 3 Output: True
Make sure your solution reads input from stdin and writes the output to stdout.
inputFormat
Input Format:
- The first line contains an integer \(n\) denoting the number of elements in the array.
- The second line contains \(n\) space-separated integers representing the array \(A\). If \(n = 0\), this line will be empty.
- The third line contains an integer \(X\) representing the target element.
outputFormat
Output Format:
- Print
True
(case-sensitive) if \(X\) exists in \(A\), otherwise printFalse
.
5
1 2 3 4 5
3
True