728x90
출처-https://www.acmicpc.net/problem/10818
728x90
mport java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan=new Scanner(System.in);
int num=scan.nextInt();;
int n[]=new int[num];
for (int i=0;i<num;i++)
n[i]=scan.nextInt();
int min=n[0];
int max=n[0];
for (int i=0;i<num;i++) {
if (min>=n[i])
min=n[i];
if (max<=n[i])
max=n[i];
}
System.out.println(min+" "+max);
}
}
728x90
'Problem Solving > BOJ' 카테고리의 다른 글
[백준, BOJ 2439] 별 찍기 - 2 (java) (0) | 2020.08.13 |
---|---|
[백준, BOJ 2438] 별 찍기 - 1 (java) (0) | 2020.08.13 |
[백준, BOJ 8393] 합 (java) (0) | 2020.08.08 |
[백준, BOJ 1924] 2007년 (java) (0) | 2020.08.08 |
[백준, BOJ 2739] 구구단 (java) (0) | 2020.08.08 |