Pagini recente » Cod sursa (job #971967) | Cod sursa (job #538634) | Cod sursa (job #1831393) | Cod sursa (job #1400341) | Cod sursa (job #2588553)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("stirling.in");
ofstream fout("stirling.out");
const int nmax=205;
const int mmax=205;
const int mo=98999;
int dp[nmax][mmax];
void stirling2()
{
dp[0][0]=1;
for(int i=1;i<=nmax;i++)
for(int j=1;j<=min(i,mmax);j++)
dp[i][j]=(dp[i-1][j-1]+j*dp[i-1][j])%mo;
}
int main()
{
int t;
fin>>t;
stirling2();
while(t--)
{
int x,n,m;
fin>>x>>n>>m;
if(x==2)
fout<<dp[n][m]%mo<<"\n";
else
fout<<"-1\n";
}
return 0;
}