슈콩

[SWEA] 극장 좌석 본문

Algorithms/SWEA

[SWEA] 극장 좌석

shukong 2025. 11. 18. 19:00

 

 

[문제]

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWz5yIfq74QDFARQ

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

 

 

[소스 코드]

import java.io.*;
import java.util.*;
public class Solution {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		int T = Integer.parseInt(br.readLine());
		for(int tc=1;tc<=T;tc++) {
			int n = Integer.parseInt(br.readLine());
			int max = 0;
			int sum = 0;
			st = new StringTokenizer(br.readLine());
			for(int i=0;i<n;i++) {
				int val = Integer.parseInt(st.nextToken());
				sum += val;
				max = Math.max(max, val);
			}
			System.out.println("#"+tc+" "+(max+sum+n));
		}
	}
}

'Algorithms > SWEA' 카테고리의 다른 글

[SWEA] 테네스의 특별한 소수  (0) 2025.11.18
[SWEA] 성공적인 공연 기획  (0) 2025.11.18
[SWEA] 명진이와 동휘의 숫자 맞추기  (0) 2025.11.18
[SWEA] 유효기간  (0) 2025.11.18
[SWEA] 홀수일까 짝수일까  (0) 2025.11.17