'commit'
This commit is contained in:
24
TangDou/XiTi/1067.cpp
Normal file
24
TangDou/XiTi/1067.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user