Friday, January 29, 2016

Algorithm - Intro to Tutorial Challenges

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */  
    long long t,i,j,a;
    while(cin>>t)
        {
        cin>>a;
        long long arr[a];
        for(i=0; i<a; i++)
            {
            cin>>arr[i];
        }
        for(i=0; i<a; i++)
            {
            if(arr[i]==t) cout<<i<<endl;
        }
    }
    return 0;
}

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)