Skip to content

Instantly share code, notes, and snippets.

@torpedo87
Created March 4, 2017 06:36
Show Gist options
  • Save torpedo87/e08bd26cddd9bd437d13f5aefb4f1d87 to your computer and use it in GitHub Desktop.
Save torpedo87/e08bd26cddd9bd437d13f5aefb4f1d87 to your computer and use it in GitHub Desktop.
function main() {
var s_temp = readLine().split(' ');
var s = parseInt(s_temp[0]);
var t = parseInt(s_temp[1]);
var a_temp = readLine().split(' ');
var a = parseInt(a_temp[0]);
var b = parseInt(a_temp[1]);
var m_temp = readLine().split(' ');
var m = parseInt(m_temp[0]);
var n = parseInt(m_temp[1]);
apple = readLine().split(' ');
apple = apple.map(Number);
orange = readLine().split(' ');
orange = orange.map(Number);
var appleNum=0;
for(var i=0; i<m; i++){
if(a+apple[i]>=s && a+apple[i]<=t){
appleNum+=1;
}
}
var orangeNum=0;
for(var i=0; i<n; i++){
if(b+orange[i]>=s && b+orange[i]<=t){
orangeNum+=1;
}
}
console.log(appleNum);
console.log(orangeNum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment