[Algorithm] BOJ 10818
#include <iostream>
using namespace std;
int main()
{
int n,tmp;
int small = 0;
int large = 0;
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> tmp;
if(i == 0)
{
small = tmp;
large = tmp;
}
else
{
if(large < tmp)
large = tmp;
else if(small > tmp)
small = tmp;
}
}
cout << small << " " << large;
return 0;
}
댓글남기기