题解 | #数的阶乘#
数的阶乘
https://ac.nowcoder.com/acm/problem/14840
疑问 为啥我这样写就不对 他说我编译错误
#define ll long long int
ll a,sum=1;
ll digui(ll x)
{
if(x==a+1)
return sum;
sum=sum*x;
digui(x+1);
}
int main ()
{
scanf("%lld",&a);
printf("%lld",digui(1));
}
然后我加了个return 在递归里
#define ll long long int
ll a,sum=1;
ll digui(ll x)
{
if(x==a+1)
return sum;
sum=sum*x;
return digui(x+1);
}
int main ()
{
scanf("%lld",&a);
printf("%lld",digui(1));
}
然后就对了