Mã chấm: 268198
Main.cc: In function ‘int main()’:
Main.cc:11:25: error: no matching function for call to ‘pow(int)’
q+=(float)pow(-1),i)*4/(2*i+1);
^
In file included from /usr/include/features.h:424:0,
from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
from /usr/include/stdio.h:27,
from Main.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:140:1: note: candidate: double pow(double, double)
__MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:140:1: note: candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/7/math.h:36:0,
from Main.cc:3:
/usr/include/c++/7/cmath:388:3: note: candidate: constexpr float std::pow(float, float)
pow(float __x, float __y)
^~~
/usr/include/c++/7/cmath:388:3: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/7/cmath:392:3: note: candidate: constexpr long double std::pow(long double, long double)
pow(long double __x, long double __y)
^~~
/usr/include/c++/7/cmath:392:3: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/7/cmath:415:5: note: candidate: template constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)
pow(_Tp __x, _Up __y)
^~~
/usr/include/c++/7/cmath:415:5: note: template argument deduction/substitution failed:
Main.cc:11:25: note: candidate expects 2 arguments, 1 provided
q+=(float)pow(-1),i)*4/(2*i+1);
^
Main.cc:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
~~~~~^~~~~~~~~