Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <cstdlib>
- using namespace std;
- void sherry()
- {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- int main()
- {
- sherry();
- long long x, a, flag = 1;
- cin >> x;
- long long arr[x];
- for (int i = 0; i < x; i++)
- {
- cin >> arr[i];
- }
- cin >> a;
- for (int j = 0; j < x; j++)
- {
- if ((arr[j] == a) && (flag == 1))
- {
- cout << j;
- flag = 0;
- }
- }
- if (flag)
- {
- cout << "-1";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement