[JAVA] SWEA 3314 - 보충학습과 평균

5909 단어 algorithmSWEASWEA

import java.util.*;
class Solution
{
    public static final int COUNT = 5;

	public static void main(String args[]) throws Exception
	{
        Scanner sc = new Scanner(System.in);
        StringBuffer sb = new StringBuffer();

        int TC = Integer.parseInt(sc.nextLine());

        for(int tc=1; tc<=TC; tc++) {
            sb.append("#").append(tc).append(" ");
            int sum = 0;
            for(int j = 0; j < COUNT; j++){
                int score = sc.nextInt();
                sum += score < 40 ? 40 : score;
            }
            sb.append((int)(sum / COUNT)).append("\n");
        }
        System.out.println(sb);
    }
}

좋은 웹페이지 즐겨찾기