3 solutions

  • 1
    @ 2026-5-16 15:28:15

    #include using namespace std;

    int main() { int m, a[105], n, i; cin >> m; for (i = 0; i < m; i++) cin >> a[i]; cin >> n; for (i = 0; i < m; i++) if (a[i] == n) { cout << i + 1; return 0; } cout << -1; return 0; }

    • 1
      @ 2026-5-16 15:25:41

      return 0;

      • 0
        @ 2026-7-27 22:01:47

        #include <bits/stdc++.h> using namespace std;

        int main() { int m, a[105], n, i; cin >> m; for (i = 0; i < m; i++) cin >> a[i]; cin >> n; for (i = 0; i < m; i++) if (a[i] == n) { cout << i + 1; return 0; } cout << -1; return 0; }

        • 1

        Information

        ID
        28628
        Time
        1000ms
        Memory
        256MiB
        Difficulty
        5
        Tags
        # Submissions
        30
        Accepted
        15
        Uploaded By