forked from pujakri5438/hacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppleAndOrange.java
More file actions
29 lines (29 loc) · 830 Bytes
/
AppleAndOrange.java
File metadata and controls
29 lines (29 loc) · 830 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
import java.util.*;
public class AppleAndOrange {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int s = sc.nextInt();
int t = sc.nextInt();
int a = sc.nextInt();
int b = sc.nextInt();
int m = sc.nextInt();
int n = sc.nextInt();
int am[] = new int[m];
int bn[] = new int[n];
int countapples=0,countoranges=0;
for(int i=0;i<m;i++)
{
am[i]=sc.nextInt();
if(a + am[i] >=s && a+am[i]<=t)
countapples++;
}
for(int j=0;j<n;j++)
{
bn[j]=sc.nextInt();
if(b + bn[j] >=s && b+bn[j]<=t)
countoranges++;
}
System.out.println(countapples);
System.out.println(countoranges);
}
}