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<stdio.h>
int n,m;
int mod=1000000007;
int mpow(int x,int y){
if(y==0)return 1;
long long int r=mpow(x,y/2);
r*=r;
r%=mod;
if(y%2==1){
r*=x;
r%=mod;
}
return r;
}
long long int minv(int x){
return mpow(x,mod-2);
}
int main(){
int i;
long long int ans;
scanf("%d%d",&n,&m);
ans=0;
for(i=m+2;i<=n+1;i++){
ans+=minv(i)*(n+2-i);
ans%=mod;
}
ans*=n+1;
ans%=mod;
for(i=1;i<=n;i++){
ans*=i;
ans%=mod;
}
printf("%lld",ans);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |