Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
73124 梁敖铭 处理随机数 C++ Compile Error 0 MS 0 KB 492 2024-05-18 09:04:27

Tests(0/0):


Code:

#include<iostream> using namespace std; int l,m,max; int n,end; int a[100000]={0}; int b[]={0}; int c[]={0}; int cnt=0; int main(){ cin>>m; for(int i=1;i<=m;i++){ cin >> n; a[i]=n; b[n]++; } max=a[i] for(int i=1;j<=m;i++){ if(b[i]=1){ c[i]=b[i]; } } for(int i=1;i<=m;i++){ if(c[i]>max){ max=c[i]; } } cout<<max; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:17:5: error: reference to 'max' is ambiguous
     max=a[i]
     ^
Main.cc:3:9: note: candidates are: int max
 int l,m,max;       
         ^
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.cc:1:
/usr/include/c++/5/bits/stl_algobase.h:265:5: note:                 template 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 const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
Main.cc:17:11: error: 'i' was not declared in this scope
     max=a[i]
           ^
Main.cc:18:20: error: 'j' was not declared in this scope
        for(int i=1;j<=m;i++){
                    ^
Main.cc:24:21: error: reference to 'max' is ambiguous
             if(c[i]>max){
                     ^
Main.cc:3:9: note: candidates are: int max
 int l,m,max;       
         ^
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.cc:1:
/usr/include/c++/5/bits/stl_algobase.h:265:5: note:                 template 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 const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
Main.cc:25:17: error: reference to 'max' is ambiguous
                 max=c[i];
                 ^
Main.cc:3:9: note: candidates are: int max
 int l,m,max;       
         ^
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.cc:1:
/usr/include/c++/5/bits/stl_algobase.h:265:5: note:                 template 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 const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
Main.cc:28:10: error: reference to 'max' is ambiguous
    cout< 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 const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^