ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1263. Elections

Where 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);
      }
    }
}