We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
final int n = in.nextInt();
final float[] count = new float[3];
for (int i=0;i<n;i++) {
count[1+Integer.signum(in.nextInt())]++;
}
System.out.printf("%.6f %n",count[2]/n);
System.out.printf("%.6f %n",count[0]/n);
System.out.printf("%.6f %n",count[1]/n);
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
Or for short:
import java.util.Scanner;
public class Solution {
}