当前位置:网站首页>2022 Henan Mengxin League game (3): Henan University L - synthetic game
2022 Henan Mengxin League game (3): Henan University L - synthetic game
2022-07-26 04:31:00 【WA_ automata】
L - Synthetic games

- Time complexity O ( t × l o g ( n ) ) O(t × log(n)) O(t×log(n))
#include<bits/stdc++.h>
using 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<<res<<endl;
}
return 0;
}
边栏推荐
猜你喜欢

p-范数(2-范数 即 欧几里得范数)

七、RESTful

Postman 导入curl 、导出成curl、导出成对应语言代码

Creative design principle of youth maker Education

Build a maker Education Laboratory for teenagers

P-norm (2-norm is Euclidean norm)

性能和成本的综合架构:单元化架构

Use Baidu PaddlePaddle easydl to complete garbage classification
Yuansaka Lin wallpaper

Array sort 3
随机推荐
1. Mx6u system migration-6-uboot graphical configuration
Swiftui one day crash
力扣每日一题-第42天-661. 图片平滑器
The difference between positive samples, negative samples, simple samples and difficult samples in deep learning (simple and easy to understand)
Page pull-up refresh and pull-down loading
TIA botu WinCC Pro controls the display and hiding of layers through scripts
2022杭电多校 DOS Card(线段树)
五、域对象共享数据
Array sort 3
自动化测试框架该如何搭建?
这种是我的vs没连上数据库吗
低成本、快速、高效搭建数字藏品APP、H5系统,扇贝科技专业开发更放心!
人脸数据库收集总结
9、 File upload and download
Dijikstra (preprocessing first) +dfs, relocation truncated to fit
Array sort 1
SwiftUI一日速成
Offline installation of idea plug-in (continuous update)
P-norm (2-norm is Euclidean norm)
UE4 keyboard control switch light