Created
November 9, 2018 13:19
-
-
Save Semior001/fb2aca0dacba01043f56f67834b820ed to your computer and use it in GitHub Desktop.
solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
const int MAXN = 1000000; | |
int n, x; | |
int a[MAXN+10]; | |
bool findX(int i){ | |
if(i >= n) | |
return false; | |
if(a[i] == x) | |
return true; | |
else | |
return findX(i+1); | |
} | |
int main(){ | |
cin >> n; | |
for(int i = 0; i < n; i++){ | |
cin >> a[i]; | |
} | |
cin >> x; | |
if(findX(0)) | |
cout << "Yes"; | |
else | |
cout << "No"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment