Pagini recente » Cod sursa (job #2080010) | Cod sursa (job #806332) | Cod sursa (job #760242) | Cod sursa (job #2505269) | Cod sursa (job #2373662)
#include <fstream>
#define MOD 98999;
using namespace std;
ifstream f("stirling.in");
ofstream g("stirling.out");
int s[205][205], S[205][205];
int x, n, m;
void speta1()
{
s[0][0]=1;
s[1][1]=1;
for(int x=1; x<=200; x++)
for(int y=x; y>0; y--)
s[x][y]=(s[x-1][y-1]-(x-1)*s[x-1][y])%MOD;
}
void speta2()
{
S[1][1]=1;
S[0][0]=1;
for(int x=1; x<=200; x++)
for(int y=x; y>0; y--)
S[x][y]=(S[x-1][y-1]+y*S[x-1][y])%MOD;
}
int main()
{
int t;
f>>t;
speta2();
speta1();
for(int i=0; i<t; i++)
{
f>>x>>n>>m;
if(x==2)
g<<S[n][m]<<endl;
else
g<<s[n][m]<<endl;
}
return 0;
}