-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppleAndOrange.java
37 lines (34 loc) · 1.02 KB
/
AppleAndOrange.java
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
34
35
36
37
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 acount = 0;
int ocount = 0;
int[] apple = new int[m];
for(int apple_i=0; apple_i < m; apple_i++){
apple[apple_i] = in.nextInt();
if(((apple[apple_i]+a) >= s)&&((apple[apple_i]+a) <= t)){
acount++;
}
}
int[] orange = new int[n];
for(int orange_i=0; orange_i < n; orange_i++){
orange[orange_i] = in.nextInt();
if(((orange[orange_i]+b) >= s)&&((orange[orange_i]+b) <= t)){
ocount++;
}
}
System.out.println(acount);
System.out.println(ocount);
}
}