| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 118601 | 罗迎甲 | 22第n项的数 | C++ | Compile Error | 0 MS | 0 KB | 540 | 2025-05-05 16:41:54 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,d1,d2,sum,a[101]; cin>>n;//等差an=a1+(n-1)*d 等丙an=a1*q^(n-1) for(int i=0;i<4;i++){ cin>>a[i]; } d1=a[1]-a[0]; d2=a[2]-a[1]; if(d2==d1) sum=a[0]+(n-1)*d1; else sum=a[0]*pow(a[1]/a[0]n-1); return 0; }
Main.cc: In function 'int main()':
Main.cc:18:31: error: expected ')' before 'n'
sum=a[0]*pow(a[1]/a[0]n-1);
^
Main.cc:18:34: error: no matching function for call to 'pow(int)'
sum=a[0]*pow(a[1]/a[0]n-1);
^
In file included from /usr/include/features.h:367:0,
from /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h:482,
from /usr/include/c++/5/iostream:38,
from Main.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note: candidate: double pow(double, double)
__MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:153:1: note: candidate expects 2 arguments, 1 provided
In file included from Main.cc:5:0:
/usr/include/c++/5/cmath:434: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++/5/cmath:434:5: note: template argument deduction/substitution failed:
Main.cc:18:34: note: candidate expects 2 arguments, 1 provided
sum=a[0]*pow(a[1]/a[0]n-1);
^
In file included from Main.cc:5:0:
/usr/include/c++/5/cmath:411:3: note: candidate: constexpr long double std::pow(long double, long double)
pow(long double __x, long double __y)
^
/usr/include/c++/5/cmath:411:3: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/5/cmath:407:3: note: candidate: constexpr float std::pow(float, float)
pow(float __x, float __y)
^
/usr/include/c++/5/cmath:407:3: note: candidate expects 2 arguments, 1 provided