Skip to content

Instantly share code, notes, and snippets.

@Semior001
Created November 9, 2018 13:19
Show Gist options
  • Save Semior001/fb2aca0dacba01043f56f67834b820ed to your computer and use it in GitHub Desktop.
Save Semior001/fb2aca0dacba01043f56f67834b820ed to your computer and use it in GitHub Desktop.
solution
#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