실행 실패 (제출 코드 컴파일 에러)
{"stderr": "Main.cpp: In function \u2018int main()\u2019:\nMain.cpp:19:13: error: no match for \u2018operator+=\u2019 (operand types are \u2018int\u2019 and \u2018__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type\u2019 {aka \u2018std::__cxx11::basic_string<char>\u2019})\n 19 | sum += s.top();\n | ~~~~^~~~~~~~~~\nMain.cpp:20:16: error: invalid cast from type \u2018std::string\u2019 {aka \u2018std::__cxx11::basic_string<char>\u2019} to type \u2018int\u2019\n 20 | sum += (int) num;\n | ^~~~~~~~~\nMain.cpp:22:25: error: no matching function for call to \u2018std::__cxx11::basic_string<char>::basic_string(int&)\u2019\n 22 | s.push((string) sum);\n | ^~~\nIn file included from /usr/include/c++/11/string:55,\n from /usr/include/c++/11/bits/locale_classes.h:40,\n from /usr/include/c++/11/bits/ios_base.h:41,\n from /usr/include/c++/11/ios:42,\n from /usr/include/c++/11/ostream:38,\n from /usr/include/c++/11/iostream:39,\n from Main.cpp:1:\n/usr/include/c++/11/bits/basic_string.h:664:9: note: candidate: \u2018template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with _Tp = _Tp; <template-parameter-2-2> = <template-parameter-1-2>; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]\u2019\n 664 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc())\n | ^~~~~~~~~~~~\n/usr/include/c++/11/bits/basic_string.h:664:9: note: template argument deduction/substitution failed:\nIn file included from /usr/include/c++/11/bits/move.h:57,\n from /usr/include/c++/11/bits/exception_ptr.h:43,\n from /usr/include/c++/11/exception:153,\n from /usr/include/c++/11/ios:39,\n from /usr/include/c++/11/ostream:38,\n from /usr/include/c++/11/iostream:39,\n from Main.cpp:1:\n/usr/include/c++/11/type_traits: In substitution of \u2018template<bool _Cond, class _Tp> using enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]\u2019:\n/usr/include/c++/11/bits/basic_string.h:125:8: required by substitution of \u2018template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using _If_sv = std::enable_if_t<std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value, _Res> [with _Tp = int; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]\u2019\n/usr/include/c++/11/bits/basic_string.h:662:30: required from here\n/usr/include/c++/11/type_traits:2579:11: error: no type named \u2018type\u2019 in \u2018struct std::enable_if<false, void>\u2019\n 2579 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;\n | ^~~~~~~~~~~\nIn file included from /usr/include/c++/11/string:55,\n from /usr/include/c++/11/bits/locale_classes.h:40,\n from /usr/include/c++/11/bits/ios_base.h:41,\n from /usr/include/c++/11/ios:42,\n from /usr/include/c++/11/ostream:38,\n from /usr/include/c++/11/iostream:39,\n from Main.cpp:1:\n/usr/include/c++/11/bits/basic_string.h:653:9: note: candidate: \u2018template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _Tp = _Tp; <template-parameter-2-2> = <template-parameter-1-2>; _CharT (...truncated, total 18450 characters)
정답 개수:
-
틀린 개수:
-
실행 실패 개수:
-
반례를 발견하지 못했습니다.