본문 바로가기
알고리즘풀이/백준-자바

[백준/JAVA] 4344번 평균은 넘겠지

by 이얏호이야호 2020. 7. 23.

import java.util.Scanner;

import java.util.Stack;


public class Main {

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

int lineCount = in.nextInt();

for (int i = 0; i < lineCount; i++) {

int studentC = in.nextInt();

int[] arr = new int[studentC];

double sum = 0;

double average=0;

double per = 0;

int resultC=0;

for (int j = 0; j < studentC; j++) {

arr[j] = in.nextInt();

sum += arr[j];

}

average = (double)sum / studentC;

for (int j = 0; j < studentC; j++) {

if(average < arr[j])

resultC++;

}

System.out.format("%.3f%%%n", 100 * (double)resultC /studentC);

}

}

}


더 많은 백준 코드가 보고 싶다면 ?  https://chuinggun.tistory.com/category/%EB%B0%B1%EC%A4%80


댓글