|
|
back to boardWhere is the mistake? Posted by Me 5 Aug 2014 20:26 import java.text.DecimalFormat; import java.util.Scanner;
public class prob {
public static void main(String[] args) { Scanner c = new Scanner(System.in); DecimalFormat twoDecimals = new DecimalFormat("0.00%"); int n = c.nextInt(); int counter = 0; double m = c.nextInt(); int []a = new int [c.nextInt()]; for(int i = 0; i < a.length; i++){ a[i]= c.nextInt(); } for(int j = 1; j<=n; j++){ int z = j; for (int i = 0; i < a.length; i++){ if(a[i] == z) counter++; } System.out.println(counter*100 / m); } } } |
|
|