# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
19001 | | kriii | 순열 (kriii4_T) | C++14 | | 46 ms | 8896 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
const long long mod = 1000000007;
long long inv[1000001];
int main()
{
long long n,k,f=1,a=0; scanf ("%lld %lld",&n,&k);
inv[1] = 1;
for (long long l=1;l<=n;l++){
inv[l+1] = (mod - mod / (l + 1)) * inv[mod % (l + 1)] % mod;
if (l > k) a = (a + inv[l + 1] * (n - l + 1)) % mod;
f = f * (l + 1) % mod;
}
printf ("%lld\n",a*f%mod);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |