πŸ•Έ Algorithm/πŸ•Έ λ°±μ€€ BaekJoon

[λ°±μ€€][java][10818][μ΅œμ†Œ, μ΅œλŒ€]

뉴이 NUEY 2023. 10. 15. 22:15
λ°˜μ‘ν˜•

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	// 10818	μ΅œμ†Œ, μ΅œλŒ€
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] nArr = new int[n];
		
		for (int i=0; i<n; i++) {
			nArr[i] = sc.nextInt();
		}
		sc.close();
		
		Arrays.sort(nArr);
		
		System.out.printf("%d %d", nArr[0], nArr[n-1]);
	}
}

 

 

 

λ°˜μ‘ν˜•