You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
450 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[1000] = {0};
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int x;
cin >> x;
bool found = false;
for (int i = 0; i < n; i++) {
if (a[i] == x) {
cout << i + 1 << endl;
found = true;
break;
}
}
if (!found) cout << -1 << endl;
return 0;
}