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;
}

最新文章

  1. layer弹窗监控键盘事件
  2. Beta版本——第五次冲刺博客
  3. Top Data Scientists to Follow &amp; Best Data Science Tutorials on GitHub
  4. 【宋红康学习日记1】关于环境变量设置出现的问题——找不到或无法加载主类 java
  5. jQuery取值相加
  6. uva 796 Critical Links(无向图求桥)
  7. JavaScript 比较操作符,严格比较===
  8. POJ3307+找规律
  9. ListView与DataTable传递数据
  10. Oracle管道函数(Pipelined Table Function)介绍
  11. WEB服务器:Apache、Tomcat、JBoss、WebLogic、Websphere、IIS的区别与关系
  12. iOS进阶
  13. Bootstrap3基础 栅格系统 标尺(col-lg/md/sm/xs-1)
  14. shell练习题7
  15. Python中文问题
  16. Scala学习笔记(二):object、伴生对象和基本类
  17. redmine安装-BitNami 提供的一键安装程序
  18. adb设置逍遥游
  19. win7怎么去除快捷方式的小箭头
  20. IDEA/Git 设置多个push远程仓库或者同时提交多个push仓库

热门文章

  1. agc016C - +/- Rectangle(构造 智商题)
  2. ArcGIS 从FileGDB中导出数据异常 000732
  3. ubuntu14.04安装gradle
  4. hadoop2.4 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  5. Mybatis-注解开发
  6. solr数据分片相关
  7. 02-CSS基础与进阶-day13_2018-09-21-20-05-21
  8. 委托、事件与Observer设计模式
  9. org.hibernate.hql.internal.ast.QuerysyntaxException:user is not mapped [from User where user_code=? and user_password=?]
  10. 十六、MySQL LIKE 子句