让我来发个题解吧!

一条铁鱼  •  2个月前


#include<iostream>
using namespace std;
typedef long long LL;
LL jie(LL x){
	if(x==1||x==0){
		return 1;
	}
	return x*jie(x-1);
}
int main(){
	LL n;
	cin>>n; 
	cout<<n<<"!="<<jie(n);
	return 0;
}

注意:0!也是等于1的(别问我是怎么知道的)。


评论: