# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
19990 | | ainta | 순열 (kriii4_T) | C++98 | | 891 ms | 16864 KiB |
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>
#include<algorithm>
using namespace std;
int n, K;
long long F[1010000], InvF[1010000], Mod = 1000000007, Res;
long long Pow(long long a, int b){
long long r = 1;
while(b){
if(b&1)r=r*a%Mod;
a=a*a%Mod;b>>=1;
}
return r;
}
int main(){
int L, i;
scanf("%d%d",&n,&K);
F[0]=InvF[0]=1;
for(i=1;i<=n+1;i++){
F[i]=F[i-1]*i%Mod;
InvF[i] = Pow(F[i],Mod-2);
}
for(L=K+1;L<=n;L++){
Res = (Res + F[L]*F[n-L+1]%Mod*F[n+1]%Mod*InvF[L+1]%Mod*InvF[n-L])%Mod;
}
printf("%lld\n",Res);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |