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<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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |