Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- 건강
- 코딩테스트
- DP
- 문제해결
- MySQL
- db
- 프로그래머스
- COS PRO
- oracle
- 러닝일지
- 시뮬레이션
- SQL
- greedy
- priorityqueue
- binary search
- dfs
- Java
- 투포인터
- 문자열
- 자바
- 문제풀이
- 운동기록
- 백준
- SWEA
- math
- 이분탐색
- BFS
- BOJ
- 알고리즘
- 코테
Archives
- Today
- Total
슈콩
[SWEA] 1일차 - Flattern 본문



[문제]
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV139KOaABgCFAYh
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
[소스 코드]
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
for(int tc=1;tc<=10;tc++) {
int n = Integer.parseInt(br.readLine());
int[] box = new int[100];
st = new StringTokenizer(br.readLine());
for(int i=0;i<100;i++) {
box[i] = Integer.parseInt(st.nextToken());
}
for(int i=0;i<n;i++) {
Arrays.sort(box);
box[0]++;
box[99]--;
}
Arrays.sort(box);
System.out.println("#"+tc+" "+(box[99]-box[0]));
}
}
}'Algorithms > SWEA' 카테고리의 다른 글
| [SWEA] 농작물 수확하기 (0) | 2025.11.03 |
|---|---|
| [SWEA] N-Queen (0) | 2025.10.30 |
| [SWEA] 햄버거 다이어트 (0) | 2025.10.30 |
| [SWEA] 2일차 - 최대상금 (0) | 2025.10.30 |
| [SWEA] 1일차 - VIEW (0) | 2025.10.30 |