-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathaverageseasy.java
More file actions
45 lines (33 loc) · 878 Bytes
/
Copy pathaverageseasy.java
File metadata and controls
45 lines (33 loc) · 878 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
34
35
36
37
38
39
40
41
42
43
44
45
import java.util.ArrayList;
import java.util.Scanner;
public class averageseasy {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int cases = scan.nextInt();
for (int zax = 0; zax < cases; zax++)
{
int CS = scan.nextInt();
int EC = scan.nextInt();
ArrayList<Integer> cs = new ArrayList<>();
ArrayList<Integer> ec = new ArrayList<>();
for (int i = 0; i < CS; i++)
cs.add(scan.nextInt());
for (int i = 0; i < EC; i++)
ec.add(scan.nextInt());
int totalCS = 0;
int totalEC = 0;
for (int i = 0; i < CS; i++)
totalCS += cs.get(i);
for (int i = 0; i < EC; i++)
totalEC += ec.get(i);
double avgCS = (double)totalCS / CS;
double avgEC = (double)totalEC / EC;
int count = 0;
for (int i = 0; i < CS; i++)
if (cs.get(i) < avgCS && cs.get(i) > avgEC)
count++;
System.out.println(count);
}
scan.close();
}
}