Submission #19001

#TimeUsernameProblemLanguageResultExecution timeMemory
19001kriii순열 (kriii4_T)C++14
100 / 100
46 ms8896 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...