3 solutions

  • 0
    @ 2026-8-26 20:39:57
    #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
    202
    Accepted
    59
    Uploaded By