第二类斯特林(Stirling)数的简单介绍和计算(小球入盒)
Posted 嚜寒
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第二类斯特林(Stirling)数的简单介绍和计算(小球入盒)相关的知识,希望对你有一定的参考价值。
#include <iostream>
#include <string.h>
#include <math.h>
using namespace std;
long long int s[111][111];
int main()
int n,m;
long long int mod=pow(10,9)+7;
while(cin>>n>>m)
//long long int g=jiecheng(m)%mod;
memset(s,0,sizeof(s));
s[0][0]=1;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
s[i][j]=((s[i-1][j-1]*(m-j+1))%mod+(j*s[i-1][j])%mod)%mod;
cout<<s[n][m]<<endl;
/**************************************
Problem id : SDUT OJ 2883
User name :
Result : Accepted
Take Memory : 572K
Take Time : 30MS
Submit Time : 2016-03-11
**************************************/
3
Hearthstone II
Time Limit: 2000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
The new season has begun, you have n competitions and m well prepared decks during the new season. Each competition you could use any deck you want, but each of the decks must be used at least once. Now you wonder how many ways are there to plan the season — to decide for each competition which deck you are going to used. The number can be very huge, mod it with 10^9 + 7.输入
The input file contains several test cases, one line for each case contains two integer numbers n and m (1 ≤ m ≤ n ≤ 100).输出
One line for each case, output one number — the number of ways.示例输入
3 2 100 25
示例输出
6 354076161
以上是关于第二类斯特林(Stirling)数的简单介绍和计算(小球入盒)的主要内容,如果未能解决你的问题,请参考以下文章