lajsdfhlaksjdfh

turing_lisihan 2023-11-11 11:02:45

askdjfhalksjdfh

共 1 条回复

turing_lisihan

#include <bits/stdc++.h> using namespace std; const int N=200006; const int mod=1000000007; int f[N]; int q(int x, int n) { if (n==0) return 1; int tmp=q(x, n/2); tmp=1LLtmptmp%mod; if (n%2==1) return 1LLtmpx%mod; return tmp; } int main() { int n, k; cin >> n >> k; k-=1; n-=1; f[0]=1; for (int i=1;i<=n;i++) f[i]=1LL*f[i-1]i%mod; cout << 1LLf[n]q(f[k], mod-2)%modq(f[n-k], mod-2)%mod; return 0; }