TOPIC

Por que no da , si esta bien?? Wrong Answer 10%

Master Chief asked 1 year ago


import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {

            double cont = 0, cont2 = 0, media = 0, media2 = 0, soma = 0;
            int alumnos = sc.nextInt();
            double vetor[] = new double[alumnos];
            for (int j = 0; j < vetor.length; j++) {
                vetor[j] = sc.nextDouble();
                soma += vetor[j];
                cont++;
            }
            media = (double) soma / cont;
            for (int j = 0; j < vetor.length; j++) {
                if (vetor[j] > media) {
                    cont2++;
                }
            }
            if (cont2 > 0) {
                media2 = (double) (100 / cont) * cont2;
            }
            System.out.printf("%.3f%%\n", media2);

        }
    }

}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.