Skip to content

Instantly share code, notes, and snippets.

@siraajul
Created February 16, 2020 03:47
Show Gist options
  • Save siraajul/30f37f2a4434b3ec6ef0a199a66be49e to your computer and use it in GitHub Desktop.
Save siraajul/30f37f2a4434b3ec6ef0a199a66be49e to your computer and use it in GitHub Desktop.
Hackerrank Problems(Algorithm)
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int s,t,a,b,m,n,ap,applecnt = 0,ora,orangecnt = 0;
cin >> s >> t >> a >> b >> m >> n;
for(int i = 0;i < m;i++)
{
cin >> ap;
if(a+ap >= s && a+ap <= t)applecnt++;
}
for(int i = 0;i < n;i++)
{
cin >> ora;
if(b+ora >= s && b+ora <= t)orangecnt++;
}
cout << applecnt <<endl<< orangecnt << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment