Compile Error

foo.cc: In function ‘int main()’:
foo.cc:10:25: error: reference to ‘max’ is ambiguous
   10 |                 if(a[i]>max)
      |                         ^~~
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/algorithm:61,
                 from stdc++.h:51:
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algo.h:5805:5: note: candidates are: ‘template<class _Tp, class _Compare> _Tp std::max(initializer_list<_Tp>, _Compare)’
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algo.h:5795:5: note:                 ‘template<class _Tp> _Tp std::max(initializer_list<_Tp>)’
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
In file included from /nix/gcc-13.2.0/include/c++/13.2.0/algorithm:60:
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:303:5: note:                 ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:257:5: note:                 ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
foo.cc:3:16: note:                 ‘int max’
    3 | int a[10005],n,max=0,cs=0;
      |                ^~~
foo.cc:11:25: error: reference to ‘max’ is ambiguous
   11 |                         max=a[i];
      |                         ^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algo.h:5805:5: note: candidates are: ‘template<class _Tp, class _Compare> _Tp std::max(initializer_list<_Tp>, _Compare)’
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algo.h:5795:5: note:                 ‘template<class _Tp> _Tp std::max(initializer_list<_Tp>)’
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:303:5: note:                 ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:257:5: note:                 ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
foo.cc:3:16: note:                 ‘int max’
    3 | int a[10005],n,max=0,cs=0;
      |                ^~~
foo.cc:15:25: error: reference to ‘max’ is ambiguous
   15 |                 if(a[i]=max)
      |                         ^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algo.h:5805:5: note: candidates are: ‘template<class _Tp, class _Compare> _Tp std::max(initializer_list<_Tp>, _Compare)’
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algo.h:5795:5: note:                 ‘template<class _Tp> _Tp std::max(initializer_list<_Tp>)’
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:303:5: note:                 ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/nix/gcc-13.2.0/include/c++/13.2.0/bits/stl_algobase.h:257:5: note:                 ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
foo.cc:3:16: note:                 ‘int max’
    3 | int a[10005],n,max=0,cs=0;
      |                ^~~

信息

递交者
类型
递交
题目
P1026 C8 最大值的出现次数
语言
C++
递交时间
2024-05-14 21:01:37
评测时间
2024-05-14 21:01:37
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes