Deep_Dev

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AWz5yIfq74QDFARQ&categoryId=AWz5yIfq74QDFARQ&categoryType=CODE&problemTitle=&orderBy=INQUERY_COUNT&selectCodeLang=ALL&select-1=3&pageSize=10&pageIndex=11 

 

SW Expert Academy

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

swexpertacademy.com

 


๊ด€๋žŒํ•˜๋Š” ์‚ฌ๋žŒ์˜ ์ˆ˜ + ๋น„์›Œ์•ผํ•˜๋Š” ์ž๋ฆฌ์˜ ๊ฐœ์ˆ˜ + ๋น„์›Œ์•ผํ•˜๋Š” ์ž๋ฆฌ์˜ ๊ฐœ์ˆ˜์ค‘ ๊ฐ€์žฅ ํฐ ์ˆ˜

 

 

 

import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner kb = new Scanner(System.in);
        int T = kb.nextInt();
        for (int t = 1; t <= T; t++) {
            int n=kb.nextInt();
            int[] arr=new int[n];
            int max=0;
            for(int i=0; i<n; i++) {
                arr[i] = kb.nextInt();
                max=Integer.max(max,arr[i]);
            }
            int sum=0;
            for(int i=0; i<n; i++){
                sum+=arr[i];
            }
            sum+=arr.length+max;
            System.out.println("#"+t+" "+sum);
        }
    }