2 solutions

  • 0
    @ 2025-10-8 10:43:22
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n,s=0,temp=1;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            temp*=i;
            temp%=1000000;
            s+=temp;
             s%=1000000;
        }
        cout<<s;
        return 0;
    }
    

Information

ID
54
Time
1000ms
Memory
256MiB
Difficulty
3
Tags
(None)
# Submissions
149
Accepted
44
Uploaded By