근본없는 코딩
[C++] 백준 10818 최소, 최대 본문

#include <iostream>
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, tmp, min=1000000, max=-1000000;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		if (tmp < min) min = tmp;
		if (tmp > max) max = tmp;
	}
	cout << min << ' ' << max;
	return 0;
}'✔ Online Judge' 카테고리의 다른 글
| [C++] 백준 10810 공넣기 (1) | 2023.06.09 | 
|---|---|
| [C++] 백준 2562 최댓값 (0) | 2023.06.09 | 
| [C++] 백준 10871 X보다 작은 수 (0) | 2023.06.09 | 
| [C++] 백준 10807 개수 세기 (0) | 2023.06.09 | 
| [C++] 백준 3단계 반복문 (1) | 2023.06.09 | 
 
                   
                   
                  