Deep_Dev

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5Pw_-KAdcDFAUq 

 

SW Expert Academy

SW ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์—ญ๋Ÿ‰ ๊ฐ•ํ™”์— ๋„์›€์ด ๋˜๋Š” ๋‹ค์–‘ํ•œ ํ•™์Šต ์ปจํ…์ธ ๋ฅผ ํ™•์ธํ•˜์„ธ์š”!

swexpertacademy.com

 

 

 

 


Arrays.sort๋กœ ์ตœ์ €๊ฐ’, ์ตœ๋Œ€๊ฐ’ 1๊ฐœ์”ฉ๋งŒ ๋นผ๊ณ ,

์†Œ์ˆ˜ 1๋ฒˆ์งธ ์ž๋ฆฌ์—์„œ ๋ฐ˜์˜ฌ๋ฆผ = Math.round(์ธ์ž) ๊ทธ๋ฆฌ๊ณ  (int)๋กœ ํ˜•๋ณ€ํ™˜ 

 

 

 

 

 

import java.util.Scanner;
import java.util.Arrays;
class Solution
{
    public static void main(String args[]) throws Exception
    {
        
        Scanner kb = new Scanner(System.in);
        int T=kb.nextInt();
        for(int test_case=1; test_case<=T; test_case++){
            int[] arr=new int[10];
            for(int i=0; i<10; i++){
                arr[i]=kb.nextInt();
            }
            Arrays.sort(arr);
            int sum=0;
            for(int i=1; i<9; i++){
                sum+=arr[i];
            }
            System.out.println("#"+test_case+" "+(int)Math.round(sum/8.0));
        }
    }
}