/ Vijos /

记录详情

Compile Error

foo.cpp: In function 'int main()':
foo.cpp:17:24: error: no matching function for call to 'max(int&, long int&)'
         M = max(M, f[j]);
                        ^
In file included from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/char_traits.h:39:0,
                 from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/ios:40,
                 from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/ostream:38,
                 from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/iostream:39,
                 from foo.cpp:1:
C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
foo.cpp:17:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
         M = max(M, f[j]);
                        ^
In file included from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/char_traits.h:39:0,
                 from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/ios:40,
                 from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/ostream:38,
                 from C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/iostream:39,
                 from foo.cpp:1:
C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
C:/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
foo.cpp:17:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long int')
         M = max(M, f[j]);
                        ^

信息

递交者
类型
递交
题目
P1317 开心的金明
语言
C++
递交时间
2017-03-02 08:47:10
评测时间
2017-03-02 08:47:10
评测机
分数
0
总耗时
248ms
峰值内存
0 Bytes