μκ³ λ¦¬μ¦ λ¬Έμ νμ΄
Q4344 νκ· μ λκ² μ§
JihyunLee
2019. 3. 26. 17:01
λ°μν
Q4344 νκ· μ λκ² μ§
κ°λ¨νκ² λ°°μ΄μ μ΄μ©ν΄μ λ¬Έμ λ₯Ό νμλ€.
package problem;//λνμ μλ΄κΈ°λ€μ 90%λ μμ μ΄ λ°μμ νκ· μ λλλ€κ³ μκ°νλ€. λΉμ μ κ·Έλ€μκ² μ¬ν μ§μ€μ μλ €μ€μΌ νλ€.import java.util.*;public class Q4344 {public static void main(String[] args) {Scanner scan = new Scanner(System.in);int num = scan.nextInt();for(int i=0; i<num; i++) {int temp2 = scan.nextInt();int[] arr = new int[temp2];int count=0;float sum=0;float average=0;//λͺ¨λ κ°μ μ΄λ μ΄μ λ΄κ³ μ 체ν©μ ꡬνλ€.for(int j=0; j<temp2; j++) {arr[j] = scan.nextInt();sum += arr[j];}average = sum/temp2;for(int j=0; j<temp2; j++) {if(arr[j]>average) {count++;}}float ans = ((float)count/(float)temp2)*100;System.out.format("%.3f",ans);System.out.print("%\n");}}}
λ°μν