apple and orange hackerrank solution in c 2b 2b

Solutions on MaxInterview for apple and orange hackerrank solution in c 2b 2b by the best coders in the world

showing results for - "apple and orange hackerrank solution in c 2b 2b"
Mario
28 Nov 2017
1#include<iostream>
2using namespace std;
3 
4int main()
5{
6      int s,t,a,b,m,n;
7    cin>>s>>t>>a>>b>>m>>n;
8    int arr[m];
9    int arr1[n];
10    int apple=0;
11    int orange=0;
12   
13
14    for(int i=0;i<m;i++){
15        cin>>arr[i];
16        if(a+arr[i]>=s && a+arr[i]<=t){
17            apple++;
18        }
19    }
20
21
22     for(int i=0;i<n;i++){
23        cin>>arr1[i];
24        if(b+arr1[i]>=s && b+arr1[i]<=t){
25            orange++;
26        }
27    }
28    cout<<apple<<endl<<orange<<endl;
29
30
31
32}