Compile Error

/in/foo.cc: In function 'bool k(std::string)':
/in/foo.cc:7:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |         for(int i=0;i<s.size();i++)
      |                     ~^~~~~~~~~
/in/foo.cc:20:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   20 |         if(d==0||s.size()<6||s.size()>12||e==1)
      |         ^~
/in/foo.cc:22:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   22 |                 if(s+b+c<2)
      |                 ^~
/in/foo.cc:22:21: error: no match for 'operator+' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
   22 |                 if(s+b+c<2)
      |                    ~^~
      |                    | |
      |                    | int
      |                    std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/12/string:47,
                 from /usr/include/c++/12/bits/locale_classes.h:40,
                 from /usr/include/c++/12/bits/ios_base.h:41,
                 from /usr/include/c++/12/ios:42,
                 from /usr/include/c++/12/istream:38,
                 from /usr/include/c++/12/sstream:38,
                 from /usr/include/c++/12/complex:45,
                 from /usr/include/c++/12/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:54,
                 from /in/foo.cc:1:
/usr/include/c++/12/bits/stl_iterator.h:630:5: note: candidate: 'template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)'
  630 |     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:630:5: note:   template argument deduction/substitution failed:
/in/foo.cc:22:22: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
   22 |                 if(s+b+c<2)
      |                      ^
/usr/include/c++/12/bits/stl_iterator.h:1786:5: note: candidate: 'template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)'
 1786 |     operator+(typename move_iterator<_Iterator>::difference_type __n,
      |     ^~~~~~~~
/usr/include/c++/12/bits/stl_iterator.h:1786:5: note:   template argument deduction/substitution failed:
/in/foo.cc:22:22: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
   22 |                 if(s+b+c<2)
      |                      ^
In file included from /usr/include/c++/12/string:53:
/usr/include/c++/12/bits/basic_string.h:3432:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 3432 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3432:5: note:   template argument deduction/substitution failed:
/in/foo.cc:22:22: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   22 |                 if(s+b+c<2)
      |                      ^
In file included from /usr/include/c++/12/string:54:
/usr/include/c++/12/bits/basic_string.tcc:606:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
  606 |     operator+(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.tcc:606:5: note:   template argument deduction/substitution failed:
/in/foo.cc:22:22: note:   mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
   22 |                 if(s+b+c<2)
      |                      ^
/usr/include/c++/12/bits/basic_string.tcc:627:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
  627 |     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.tcc:627:5: note:   template argument deduction/substitution failed:
/in/foo.cc:22:22: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   22 |                 if(s+b+c<2)
      |                      ^
/usr/include/c++/12/bits/basic_string.h:3472:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)'
 3472 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3472:5: note:   template argument deduction/substitution failed:
/in/foo.cc:22:22: note:   mismatched types 'const _CharT*' and 'int'
   22 |                 if(s+b+c<2)
      |                      ^
/usr/include/c++/12/bits/basic_string.h:3489:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)'
 3489 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3489:5: note:   template argument deduction/substitution failed:
/in/foo.cc:22:22: note:   deduced conflicting types for parameter '_CharT' ('char' and 'int')
   22 |                 if(s+b+c<2)
      |                      ^
/usr/include/c++/12/bits/basic_string.h:3502:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 3502 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3502:5: note:   template argument deduction/substitution failed:
/in/foo.cc:22:22: note:   mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   22 |                 if(s+b+c<2)
      |                      ^
/usr/include/c++/12/bits/basic_string.h:3509:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 3509 |     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3509:5: note:   template argument deduction/substitution failed:
/in/foo.cc:22:22: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   22 |                 if(s+b+c<2)
      |                      ^
/usr/include/c++/12/bits/basic_string.h:3516:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)'
 3516 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
/usr/include/c++/12/bits/basic_string.h:3516:5: note:   template argument deduction/substitution failed:
/in/foo.cc:22:22: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'int'
   22 |                 if(s+b+c<2)
      |                      ^
/usr/include/c++/12/bits/basic_string.h:3539:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, __cxx11::basic_strin

信息

递交者
类型
递交
题目
P2596 密码合规检测3级2 202306
语言
C++
递交时间
2026-08-04 17:42:54
评测时间
2026-08-04 17:42:54
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes