标签:表示 jpg 综合 链接 题目 排名 nbsp block cin
题目链接:http://139.129.36.234/JudgeOnline/problem.php?id=1006
第二类Stirling数实际上是集合的一个拆分,表示将n个不同的元素拆分成m个集合的方案数,记为 或者 。
#include<cstdio> #include<cstring> #include<iostream> using namespace std; const int mod = 10056; int dp[1010][1010]; int main() { int t,n; cin >> t; int k = 1; while(t--){ cin >> n; dp[0][0] = 1; for(int i = 1;i <= n; i++){ for(int j = 1;j <= i; j++){ dp[i][j] = (dp[i-1][j-1]+j*dp[i-1][j])%mod; } } int num = 1; int ans = 0; for(int j = 1;j <= n; j++){ num = (num * j)%mod; ans = (ans + num*dp[n][j])%mod; } cout << "Case " << k++ << ": "; cout << ans << endl; } return 0; }
新疆大学(新大)OJ xju 1006: 比赛排名 第二类斯特林数+阶乘
标签:表示 jpg 综合 链接 题目 排名 nbsp block cin
原文地址:http://www.cnblogs.com/zhangjiuding/p/7674919.html