Created
February 16, 2020 03:47
-
-
Save siraajul/30f37f2a4434b3ec6ef0a199a66be49e to your computer and use it in GitHub Desktop.
Hackerrank Problems(Algorithm)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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