# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19151 | riantris | 최댓값 (tutorial2) | C++98 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
int N;
int *A;
cin >> N;
A = new int[N];
for(int i = 0; i < N; i++){
cin >> A[i];
if(A[i] <= 1) i--;
}
cout<<GetMax(N,A)<<endl;
return 0;
}
int GetMax(int N, int *A)
{
int _temp;
for(int i = 0; i <N - 1; i++)
{
for(int j = 0; j <N -1 -i; j++)
{
if(A[i]<A[i+1])
{
_temp = A[j];
A[j] = A[j+1];
A[j+1] = _temp;
}
}
}
return A[0];
}