Pagini recente » Cod sursa (job #391467) | Cod sursa (job #934821) | Cod sursa (job #2215815) | Cod sursa (job #835280) | Cod sursa (job #2062775)
#include <fstream>
#define maxn 205
using namespace std;
int s[maxn][maxn], S[maxn][maxn];
ifstream fin("stirling.in");
ofstream fout("stirling.out");
int main()
{
s[1][1]=S[1][1]=1;
for(int i=2;i<=200;i++)
for(int j=1;j<=i;j++)
{
s[i][j]=(s[i-1][j-1]-((i-1)*s[i-1][j]))%98999;
S[i][j]=(S[i-1][j-1]-(j*S[i-1][j]))%98999;
}
int k, cer, n, m;
fin>>k;
while(k)
{
fin>>cer>>n>>m;
if(cer==1)
fout<<s[n][m]<<'\n';
else
fout<<S[n][m]<<'\n';
k--;
}
return 0;
}