제출 결과
# 제출자 문제 ID 언어 상태 점수 제출 시간
448521 minky524 MAX_SUBARRAY C++ 컴파일 에러 0 / 100 1주, 3일 전
컴파일 결과 ERROR
source.cpp: In function ‘int main()’:
source.cpp:24:25: error: no matching function for call to ‘max(int, long int&)’
         sum = max(0, sum) + arr[i];
                         ^
source.cpp:24:25: note: candidates are:
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from source.cpp:3:
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note:   template argument deduction/substitution failed:
source.cpp:24:25: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long int’)
         sum = max(0, sum) + arr[i];
                         ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from source.cpp:3:
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note:   template argument deduction/substitution failed:
source.cpp:24:25: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long int’)
         sum = max(0, sum) + arr[i];
                         ^
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from source.cpp:4:
/usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^
/usr/include/c++/4.8/bits/stl_algo.h:4231:5: note:   template argument deduction/substitution failed:
source.cpp:24:25: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘int’
         sum = max(0, sum) + arr[i];
                         ^
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from source.cpp:4:
/usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algo.h:4236:5: note:   template argument deduction/substitution failed:
source.cpp:24:25: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘int’
         sum = max(0, sum) + arr[i];
                         ^
source.cpp:25:33: error: no matching function for call to ‘max(int&, long int&)’
         maxnum = max(maxnum, sum);
                                 ^
source.cpp:25:33: note: candidates are:
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from source.cpp:3:
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:216:5: note:   template argument deduction/substitution failed:
source.cpp:25:33: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long int’)
         maxnum = max(maxnum, sum);
                                 ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from source.cpp:3:
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:260:5: note:   template argument deduction/substitution failed:
source.cpp:25:33: note:   deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long int’)
         maxnum = max(maxnum, sum);
                                 ^
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from source.cpp:4:
/usr/include/c++/4.8/bits/stl_algo.h:4231:5: note: template<class _Tp> _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^
/usr/include/c++/4.8/bits/stl_algo.h:4231:5: note:   template argument deduction/substitution failed:
source.cpp:25:33: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘int’
         maxnum = max(maxnum, sum);
                                 ^
In file included from /usr/include/c++/4.8/algorithm:62:0,
                 from source.cpp:4:
/usr/include/c++/4.8/bits/stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algo.h:4236:5: note:   template argument deduction/substitution failed:
source.cpp:25:33: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘int’
         maxnum = max(maxnum, sum);
                                 ^
source.cpp:14:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
source.cpp:18:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &num);
                          ^