- 时间复杂度 O ( t × l o g ( n ) ) O(t × log(n)) O(t×log(n))
#includeusing namespace std; typedef long long LL; const int N = 100010, MOD = 1e9 + 7; int fac[N],inv[N]; int main() { fac[0]=inv[0]=1; for(int i=1;i<=100000;i++) fac[i]=(LL)fac[i-1]*i%MOD; for(int i=1;i<=100000;i++) inv[i]=(LL)inv[i-1]*500000004%MOD; int T;cin>>T; while(T--) { int n;cin>>n; int res=fac[n]; while(n) { n>>=1; res=(LL)res*inv[n]%MOD; } cout<



