Submission #20086

#TimeUsernameProblemLanguageResultExecution timeMemory
20086gs12117순열 (kriii4_T)C++98
100 / 100
1114 ms1084 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...