Submission #1774595
Source Code Expand
#include<cstdio> #include<iostream> using namespace std; const int MAX_N = 100; int n, a[MAX_N]; int max = 0, min = 1000; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { if (a[i] > max) max = a[i]; if (a[i] < min) min = a[i]; } cout << max - min << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Traveling AtCoDeer Problem |
User | Sashiming |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 345 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:14:14: error: reference to ‘max’ is ambiguous if (a[i] > max) max = a[i]; ^ ./Main.cpp:7:5: note: candidates are: int max int max = 0, min = 1000; ^ In file included from /usr/include/c++/5/bits/char_traits.h:39:0, from /usr/include/c++/5/ios:40, from /usr/include/c++/5/ostream:38, from /usr/include/c++/5/iostream:39, from ./Main.cpp:2: /usr/include/c++/5/bits/stl_algobase.h:265:5: note: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /usr/include/c++/5/bits/stl_algobase.h:219:5: note: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&) max(const _Tp& __a, const _Tp& __b) ^ ./Main.cpp:14:19: error: reference to ‘max’ is ambiguous if (a[i] > max) max = a[i]; ^ ./Main.cpp...