소스
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int a = scan.nextInt();
int[] arr = new int[a];
for (int i = 0; i < a; i++) {
arr[i] = scan.nextInt();
}
System.out.print(arr[0] + " " + arr[a - 1]);
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
cs |
Arrays.sort 는 배열을 오름차순으로 정렬시켜주는 메소드
(참고 : https://st-lab.tistory.com/43)
[백준] 10818번 : 최소, 최대 - JAVA [자바]
https://www.acmicpc.net/problem/10818 10818번: 최소, 최대 첫째 줄에 정수의 개수 N (1 ≤ N ≤ 1,000,000)이 주어진다. 둘째 줄에는 N개의 정수를 공백으로 구분해서 주어진다. 모든 정수는 -1,000,000보..
st-lab.tistory.com
'알고리즘 > Java' 카테고리의 다른 글
(JAVA) 백준 알고리즘 6단계 2577번 : 숫자의 개수 (3) | 2020.04.25 |
---|---|
(JAVA)백준 단계별로 풀어보기 6단계 2562번 : 최댓값 (0) | 2020.04.24 |
(JAVA) 백준 알고리즘 5단계 10996번 : 별 찍기 - 21 (0) | 2020.04.22 |
(JAVA) 백준 알고리즘 5단계 2446번 : 별 찍기 - 9 (0) | 2020.04.22 |
(JAVA) 백준 알고리즘 5단계 2523번 : 별 찍기 - 13 (0) | 2020.04.20 |