1 条题解

  • 1
    @ 2025-1-23 15:56:14

    用递归算法即可

    #include<bits/stdc++.h>
    using namespace std;
    
    long long fun(int x){
    	if (x==1) return 1;
    	return x*fun(x-1);	
    }
    
    int main(){
    	int n;
    	cin>>n;
    	cout<<fun(n);
    	return 0;
    }
    

    信息

    ID
    140
    时间
    1000ms
    内存
    256MiB
    难度
    3
    标签
    递交数
    51
    已通过
    28
    上传者