Submission #20102

#TimeUsernameProblemLanguageResultExecution timeMemory
20102imsifile순열 (kriii4_T)C++98
100 / 100
381 ms1084 KiB
#include<stdio.h> #define mod 1000000007 #define inv(a) exp(a,mod-2) typedef long long lld; lld exp(lld a, lld b){ if(b==0)return 1; lld k=exp(a, b/2); k=(k*k)%mod; if(b%2)k=(k*a)%mod; return k; } lld n, k, sum; int main(){ lld i, fac=1; scanf("%lld%lld", &n, &k); for(i=1; i<=n+1; i++)fac=(fac*i)%mod; for(i=k+1; i<=n; i++){ lld im = fac*(n-i+1)%mod * inv(i+1); sum += im, sum%=mod; } printf("%lld", sum); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...