dh-winternagi 님의 블로그
(10818) 최소, 최대 본문
https://www.acmicpc.net/problem/10818
단계별로 풀어보기
4단계(1차원 배열) 3번째

#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, minval= 1'000'000, maxval= -1'000'000;
cin >> n;
while(n--){
int t;
cin >> t;
minval= min(minval, t);
maxval= max(maxval, t);
}
cout << minval << " " << maxval;
return 0;
}'백준 (C++) > Solve' 카테고리의 다른 글
| (10810) 공 넣기 (0) | 2026.04.09 |
|---|---|
| (2562) 최댓값 (0) | 2026.04.09 |
| (10871) X보다 작은 수 (0) | 2026.04.09 |
| (10807) 개수 세기 (0) | 2026.04.09 |
| (10951) A+B - 4 (0) | 2026.04.09 |
