(第二类斯特林数*N的阶乘 )的和。

#include <iostream>
#include <cstdio>
#include <algorithm>
#define LL __int64
#define MOD 20090126
using namespace std;
LL str[101][101];
LL con[101];
void initial(){
con[0]=1;
for(LL i=1;i<=100;i++)
con[i]=(con[i-1]*i)%MOD;
for(LL i=0;i<=100;i++){
for(LL j=0;j<=i;j++){
if(i==j) str[i][j]=1;
else if(j==0&&i>=1) str[i][j]=0;
else{
str[i][j]=((j*str[i-1][j])%MOD+str[i-1][j-1])%MOD;
}
}
}
} int main(){
initial();
LL n,T;
scanf("%I64d",&T);
while(T--){
scanf("%I64d",&n);
LL ans=0;
for(LL i=1;i<=n;i++)
ans=(ans+(str[n][i]*con[i])%MOD)%MOD;
printf("%I64d\n",ans);
}
return 0;
}

  

HDU 2643的更多相关文章

  1. HDU 2643 Rank:第二类Stirling数

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2643 题意: 有n个个选手参赛,问排名有多少种情况(可以并列). 题解: 简化问题: 将n个不同的元素 ...

  2. hdu 2643 rank 第二类斯特林数

    题意:给定n个人,要求这n个人的所有可能排名情况,可以多个人并列(这个是关键). 题解:由于存在并列的问题,那么对于n个人,我们最多有n个排名,枚举一下1~n,累加一下就好.(注意这里是变种的斯特林数 ...

  3. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  4. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  5. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  6. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  7. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  8. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  9. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

随机推荐

  1. B - Networking

    B - Networking 思路:并查集板子. #include<cstdio> #include<cstring> #include<iostream> #in ...

  2. (译)RabbitMQ ——“Hello World”

    原文地址:http://www.rabbitmq.com/tutorials/tutorial-one-dotnet.html 介绍 RabbitMQ是一个消息实体服务(broker):它接收及转发消 ...

  3. Nagios监控nginx服务具体过程

    1在nginx 服务器上安装nrpe客户端: Nginx的服务须要监控起来.不然万一down了而不及时修复,会影响web应用.例如以下web应用上面启动的nginx后台进程[root@lb-net-2 ...

  4. 初识cocos2dx——入门第一篇

    享受"啪"的按下Enter的快感. (by云风) cocos2dx是不是个toy引擎,不同的人有不同的看法.可是你不得不承认它非常受欢迎.好多非常火的手游使用的就是cocos2dx ...

  5. ubuntu 14.04开机出现错误“Error found when loading /root/.profile”解决

    在刚修改完root权限自动登录后,发现开机出现以下提示: Error found when loading /root/.profile stdin:is not a tty ………… 解决方法:在终 ...

  6. SQLSERVER 链接服务器

    1. 执行代码 EXEC sp_addlinkedserver @server='XLZFSqlServer', --链接服务器别名 @srvproduct='', @provider='SQLOLE ...

  7. javascript动画函数封装(升级版)

    //把 任意对象 的 任意数值属性 改变为 任意的目标值 function animate(obj, json, fn) { clearInterval(obj.timer); obj.timer = ...

  8. SQL学习——基础语句(4)

    前面感觉真的好乱,想哪,写哪.这里慢慢整理…… SQL Having 语句 还是前面的那两个表: grade表: student表: 我们需要查找这里的s_id下的gradeValue的和,这就要分组 ...

  9. 给SearchView设置样式

    <?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http:/ ...

  10. 反射另一个app中的View

    FrameLayout fl = (FrameLayout) findViewById(R.id.content); View v = null; try { Context context = cr ...