C++)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, temp;
vector<int> v;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> temp;
v.push_back(temp);
}
cout << *min_element(v.begin(), v.end()) << " " << *max_element(v.begin(), v.end());
return 0;
}
Python)
import sys
read = sys.stdin.readline
n = read().rstrip()
arr = list(map(int, read().rstrip().split(" ")))
print("{} {}".format(min(arr), max(arr)))'백준 1 > 기초' 카테고리의 다른 글
| [백준 10809] 알파벳 찾기 (C++/Python) (0) | 2020.12.05 |
|---|---|
| [백준 8958] OX 퀴즈 (C++/Python) (0) | 2020.12.05 |
| [백준 11721] 열 개씩 끊어 출력하기 (C++/Python) (0) | 2020.12.05 |
| [백준 11720] 숫자의 합 (C++/Python) (0) | 2020.12.05 |
| [백준 11719] 그대로 출력하기2 (C++/Python) (0) | 2020.12.05 |