|
|
back to boardWA #1 Please Help :( Alteast give me test case import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Scanner; public class Election { static long count; public static void main(String agrs[]) { Scanner scan = new Scanner(System.in); long N = scan.nextInt(); long N1 = scan.nextInt(); DecimalFormat form = new DecimalFormat("0.00"); ArrayList<Integer> array = new ArrayList<Integer>(); for (int i = 0; i < N1; i++) { array.add(scan.nextInt()); } for (int i = 1; i <= N; i++) { for (int j = 0; j < N1; j++) { if (array.get(j) == i) { count++; } } System.out.println(form.format((count * 100) / N1) + "%"); count = 0; } } } =================== Cant find any error. :( |
|
|