-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppleandOranges.java
More file actions
33 lines (31 loc) · 999 Bytes
/
AppleandOranges.java
File metadata and controls
33 lines (31 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int s = in.nextInt();
int t = in.nextInt();
int a = in.nextInt();
int b = in.nextInt();
int m = in.nextInt();
int n = in.nextInt();
int[] apple = new int[m];
for(int apple_i=0; apple_i < m; apple_i++){
apple[apple_i] = in.nextInt();
}
int[] orange = new int[n];
for(int orange_i=0; orange_i < n; orange_i++){
orange[orange_i] = in.nextInt();
}
int applectr = 0;
int orangectr = 0;
for(int i=0; i < m; i++)
applectr+=((apple[i]>=(s-a) && apple[i]<=(t-a))?1:0);
for(int i=0; i < n; i++)
orangectr+=((orange[i]>=(s-b) && orange[i]<=(t-b))?1:0);
System.out.println(applectr+"\n"+orangectr);
}
}