답안 #380412

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
380412 2021-03-21T16:06:29 Z hgmhc 최댓값 (tutorial2) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
int GetMax(int N, int *A) {
  int mx = -1;
  for (int i = 0; i < N; ++i) {
    mx = max(mx,A[i]);
  }
  return mx;
}

Compilation message

tutorial2.cpp: In function 'int GetMax(int, int*)':
tutorial2.cpp:5:10: error: 'max' was not declared in this scope; did you mean 'std::max'?
    5 |     mx = max(mx,A[i]);
      |          ^~~
      |          std::max
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from tutorial2.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: 'std::max' declared here
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~