-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaverage.java
More file actions
38 lines (38 loc) · 816 Bytes
/
average.java
File metadata and controls
38 lines (38 loc) · 816 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
import java.io.*;
import java.util.*;
import java.lang.Math.*;
class average
{
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int[] a=new int[n];
for(int i=0;i<n;i++)
{
a[i]=s.nextInt();
}
int sum1=0,sum2=0,count=0,count2=0;
for(int j=0;j<n;j++)
{
if(j<n/2)
{
sum1+=Math.abs(a[j]);
count++;
}
else{
sum2+=Math.abs(a[j]);
count2++;
}
}
sum1=sum1/count;
sum2=sum2/count2;
if(sum1==sum2)
{
System.out.println("Possible");
}
else{
System.out.println("Not Possible");
}
}
}