Submission #19826

#TimeUsernameProblemLanguageResultExecution timeMemory
19826Namnamseo순열 (kriii4_T)C++14
100 / 100
1125 ms16708 KiB
#include<cstdio> long long mans,c,mul[1000003],fac[1000003],a,b,i,j,s=1,ans,X=1e9+7; long long pow(long long aa,long long bb){ if(bb==0) return 1; long long ret=pow(aa,bb/2); ret=(ret*ret)%X; if(bb&1) ret=(ret*aa)%X; return ret; } main() { scanf("%lld%lld",&a,&b); if(b>=a) { printf("0");return 0; } fac[0]=1; for(i=1;i<=a+1;i++)fac[i]=fac[i-1]*i%X; for(i=b+1;i<=a;i++) { mans+=fac[a+1]*(a-i+1)%X*pow(i+1,X-2)%X; mans%=X; } printf("%lld",mans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...