안녕하세요. 오늘은 정렬을 할 거예요.

문제

https://www.acmicpc.net/problem/17263

아이디어

최댓값만 찾아주면 됩니다.

소스코드

#include <iostream> 
#include <algorithm>
using namespace std;


int main(void)
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int N, i, x, mx = 0;
	cin >> N;
	for (i = 0; i < N; i++)
	{
		cin >> x;
		mx = max(mx, x);
	}
	cout << mx;
}


감사합니다.

0개의 댓글

Powered by GraphCDN, the GraphQL CDN