Compile Error

foo.cc: In function ‘int main()’:
foo.cc:9:15: error: no matching function for call to ‘sqrt(__gnu_cxx::__promote_2<double, int, double, double>::__type, __gnu_cxx::__promote_2<double, int, double, double>::__type)’
    9 |         k=sqrt(pow(a,2),pow(b,2));
      |           ~~~~^~~~~~~~~~~~~~~~~~~
foo.cc:9:15: note: there are 7 candidates
In file included from /nix/gcc/include/c++/15.3.0/valarray:607,
                 from /nix/gcc/include/c++/15.3.0/x86_64-unknown-linux-gnu/bits/stdc++.h:169,
                 from foo.cc:1:
/nix/gcc/include/c++/15.3.0/bits/valarray_after.h:460:5: note: candidate 1: ‘template<class _Tp> std::_Expr<std::__detail::_UnClos<std::_Sqrt, std::_ValArray, _Tp>, _Tp> std::sqrt(const valarray<_Tp>&)’
  460 |     _DEFINE_EXPR_UNARY_FUNCTION(sqrt, struct std::_Sqrt)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc/include/c++/15.3.0/bits/valarray_after.h:460:5: note: candidate expects 1 argument, 2 provided
/nix/gcc/include/c++/15.3.0/bits/valarray_after.h:460:5: note: candidate 2: ‘template<class _Dom> std::_Expr<std::__detail::_UnClos<std::_Sqrt, std::_Expr, _Dom>, typename _Dom::value_type> std::sqrt(const _Expr<_Dom1, typename _Dom1::value_type>&)’
  460 |     _DEFINE_EXPR_UNARY_FUNCTION(sqrt, struct std::_Sqrt)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc/include/c++/15.3.0/bits/valarray_after.h:460:5: note: candidate expects 1 argument, 2 provided
In file included from /nix/gcc/include/c++/15.3.0/ccomplex:43,
                 from /nix/gcc/include/c++/15.3.0/x86_64-unknown-linux-gnu/bits/stdc++.h:133:
/nix/gcc/include/c++/15.3.0/complex:1267:5: note: candidate 3: ‘template<class _Tp> std::complex<_Tp> std::sqrt(const complex<_Tp>&)’
 1267 |     sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); }
      |     ^~~~
/nix/gcc/include/c++/15.3.0/complex:1267:5: note: candidate expects 1 argument, 2 provided
In file included from /nix/gcc/include/c++/15.3.0/x86_64-unknown-linux-gnu/bits/stdc++.h:115:
/nix/gcc/include/c++/15.3.0/cmath:461:5: note: candidate 4: ‘template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::sqrt(_Tp)’
  461 |     sqrt(_Tp __x)
      |     ^~~~
/nix/gcc/include/c++/15.3.0/cmath:461:5: note: candidate expects 1 argument, 2 provided
In file included from /nix/glibc-2.42-84-dev/include/features.h:524,
                 from /nix/gcc/include/c++/15.3.0/x86_64-unknown-linux-gnu/bits/os_defines.h:39,
                 from /nix/gcc/include/c++/15.3.0/x86_64-unknown-linux-gnu/bits/c++config.h:727,
                 from /nix/gcc/include/c++/15.3.0/cassert:45,
                 from /nix/gcc/include/c++/15.3.0/x86_64-unknown-linux-gnu/bits/stdc++.h:33:
/nix/glibc-2.42-84-dev/include/bits/mathcalls.h:180:1: note: candidate 5: ‘double sqrt(double)’
  180 | __MATHCALL (sqrt,, (_Mdouble_ __x));
      | ^~~~~~~~~~
/nix/glibc-2.42-84-dev/include/bits/mathcalls.h:180:1: note: candidate expects 1 argument, 2 provided
/nix/gcc/include/c++/15.3.0/cmath:453:3: note: candidate 6: ‘constexpr long double std::sqrt(long double)’
  453 |   sqrt(long double __x)
      |   ^~~~
/nix/gcc/include/c++/15.3.0/cmath:453:3: note: candidate expects 1 argument, 2 provided
/nix/gcc/include/c++/15.3.0/cmath:449:3: note: candidate 7: ‘constexpr float std::sqrt(float)’
  449 |   sqrt(float __x)
      |   ^~~~
/nix/gcc/include/c++/15.3.0/cmath:449:3: note: candidate expects 1 argument, 2 provided

信息

递交者
类型
递交
题目
P3183 直角三角形 GESP202606二级T1
语言
C++
递交时间
2026-10-01 07:49:10
评测时间
2026-10-14 04:33:06
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes