Pagini recente » Cod sursa (job #2339274) | Cod sursa (job #1390059) | Cod sursa (job #2444188) | Cod sursa (job #2671761) | Cod sursa (job #2588555)
#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+5][mmax+5];
void stirling2()
{
dp[0][0]=1;
dp[1][1]=1;
for(int i=2;i<=nmax;i++)
for(int j=1;j<=i;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;
}