1 solutions

  • 0
    @ 2023-12-20 19:52:02
    #include <iostream>
    #include <bits/stdc++.h>
    using namespace std;
    int jiecheng(int x){
    	int sum = 1;
    	for(int i = 1 ;i <= x ;i++){
    		sum *= i;
    	}
    	return (sum);
    }
    int main()
    {
    	int N;
    	cin >> N;
    	int sum = 0;
    	for(int i = 1 ;i <= N ;i++){
    		sum += jiecheng(i);
    	}
    	cout << sum;
    	return 0;
    }
    
    • 1

    Information

    ID
    351
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    2
    Tags
    # Submissions
    109
    Accepted
    65
    Uploaded By