이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |