1 solutions

  • 0
    @ 2023-12-4 19:29:19
    #include<stdio.h>
    long search(long array[10000],long a){
        int i=0,k=-1;
        for(i=0;i<10000;i++){
            if(array[i]==a){
                k=i;
                break;
            }
        }
        if(k>=0)
        return k+1;
        return k;
    }
    int main(){
        long i=0,n=0,a[10000]={0},x=0;
        scanf("%ld",&n);
        for(i=0;i<n;i++){
            scanf("%ld",&a[i]);
        }
        scanf("%ld",&x);
        printf("%ld\n",search(a,x));
        return 0;    
    }
    

    Information

    ID
    6773
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    6
    Tags
    (None)
    # Submissions
    199
    Accepted
    61
    Uploaded By