➽ Problem:-
https://www.hackerrank.com/challenges/apple-and-orange/problem
➽ Solution:-
#include<iostream>
using
namespace std;
int main()
{
int a, b, c, d, x, y, apple, orange;
int apple_count=0, orange_count=0;
cin >> a >> b;
cin >> c >> d;
cin >> x >> y;
for(int i=0; i<x; i++)
{
cin >> apple;
if(c+apple >= a && c+apple
<= b)
apple_count++;
}
for(int i=0; i<y; i++)
{
cin >> orange;
if(d+orange >= a && d+orange
<= b)
orange_count++;
}
cout << apple_count << endl;
cout << orange_count << endl;
return 0;
}
0 Comments
Please do not enter any spam link in the comment section.