You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
296 B

#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000
int main()
{
int i, j, n, m, S = 0;
scanf("%d", &n);
for(i = 1; i <= n; i++)
{
m = 1;
for(j = 1; j <= i; j++) m = (m*j) % MOD;
S = (S+m) % MOD;
}
printf("%d\n", S);
return 0;
}