forked from deepanshumishra/JavaAndCPP_programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplusminus.java
More file actions
28 lines (26 loc) · 704 Bytes
/
Copy pathplusminus.java
File metadata and controls
28 lines (26 loc) · 704 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
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 n = in.nextInt();
int pos = 0;
int zero = 0;
int neg = 0;
for (int i = 0; i < n; i++) {
int x = in.nextInt();
if (x > 0) {
pos++;
} else if (x == 0) {
zero++;
} else {
neg++;
}
}
System.out.println(pos / (double) n);
System.out.println(neg / (double) n);
System.out.println(zero / (double) n);
}