-
-
Notifications
You must be signed in to change notification settings - Fork 109
/
AppleandOrange.java
36 lines (34 loc) · 1009 Bytes
/
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
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 count1=0,count2=0;
int temp;
int[] apple = new int[m];
for(int apple_i=0; apple_i < m; apple_i++){
//apple[apple_i] = in.nextInt();
temp = a + in.nextInt();
if(temp>=s&&temp<=t)
count1++;
}
int[] orange = new int[n];
for(int orange_i=0; orange_i < n; orange_i++){
//orange[orange_i] = in.nextInt();
temp = b + in.nextInt();
if(temp>=s&&temp<=t)
count2++;
}
System.out.println(count1);
System.out.println(count2);
}
}