Advertisement
jbn6972

lost

Oct 24th, 2021
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define ll long long
  6. #define vi vector<int>
  7. #define vll vector<long long int>
  8.  
  9. int main()
  10. {
  11. #ifndef ONLINE_JUDGE
  12. freopen("in.txt", "r", stdin);
  13. freopen("out.txt", "w", stdout);
  14. #endif
  15.  
  16. std::ios::sync_with_stdio(false);
  17.  
  18. int t;
  19. cin >> t;
  20. while (t--)
  21. {
  22. ll n, k, pos = 0;
  23. cin >> n >> k;
  24. ll a[n];
  25. for (ll i = 0; i < n; i++)
  26. cin >> a[i];
  27.  
  28. for (ll i = 0; i < n; i++)
  29. {
  30. if (a[i] == k)
  31. {
  32. pos = i + 1;
  33. break;
  34. }
  35. }
  36. if (pos == 0)
  37. cout << "not found" << endl;
  38. else
  39. cout << pos << endl;
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement