loj2173 「FJOI2016」建筑师
2024-09-06 23:44:58
ref
真是道组合数学神题啊……第一次见第一类斯特林数……
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
int T, n, a, b, s[50005][205], c[205][205];
const int mod=1e9+7;
int main(){
for(int i=0; i<=50000; i++){
if(i<=200) s[i][i] = 1;
for(int j=1; j<=min(i-1, 200); j++)
s[i][j] = (s[i-1][j-1] + (ll)s[i-1][j]*(i-1)%mod) % mod;
}
for(int i=0; i<=200; i++){
c[i][0] = 1;
for(int j=1; j<=i; j++)
c[i][j] = (c[i-1][j-1] + c[i-1][j]) % mod;
}
cin>>T;
while(T--){
scanf("%d %d %d", &n, &a, &b);
printf("%d\n", (ll)s[n-1][a+b-2]*c[a+b-2][a-1]%mod);
}
return 0;
}
最新文章
- layer弹窗监控键盘事件
- Beta版本——第五次冲刺博客
- Top Data Scientists to Follow &; Best Data Science Tutorials on GitHub
- 【宋红康学习日记1】关于环境变量设置出现的问题——找不到或无法加载主类 java
- jQuery取值相加
- uva 796 Critical Links(无向图求桥)
- JavaScript 比较操作符,严格比较===
- POJ3307+找规律
- ListView与DataTable传递数据
- Oracle管道函数(Pipelined Table Function)介绍
- WEB服务器:Apache、Tomcat、JBoss、WebLogic、Websphere、IIS的区别与关系
- iOS进阶
- Bootstrap3基础 栅格系统 标尺(col-lg/md/sm/xs-1)
- shell练习题7
- Python中文问题
- Scala学习笔记(二):object、伴生对象和基本类
- redmine安装-BitNami 提供的一键安装程序
- adb设置逍遥游
- win7怎么去除快捷方式的小箭头
- IDEA/Git 设置多个push远程仓库或者同时提交多个push仓库
热门文章
- agc016C - +/- Rectangle(构造 智商题)
- ArcGIS 从FileGDB中导出数据异常 000732
- ubuntu14.04安装gradle
- hadoop2.4 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
- Mybatis-注解开发
- solr数据分片相关
- 02-CSS基础与进阶-day13_2018-09-21-20-05-21
- 委托、事件与Observer设计模式
- org.hibernate.hql.internal.ast.QuerysyntaxException:user is not mapped [from User where user_code=? and user_password=?]
- 十六、MySQL LIKE 子句