Pagini recente » Cod sursa (job #2796389) | Cod sursa (job #1308689) | Cod sursa (job #2321282) | Cod sursa (job #2282223) | Cod sursa (job #1349885)
#include <fstream>
#define NMax 201
using namespace std;
ifstream in ("stirling.in");
ofstream out ("stirling.out");
int S_I[NMax][NMax],S_II[NMax][NMax];
void Stirling_Speta_I ()
{
S_I[1][1]=1;
for (int n=1;n<NMax;n++)
for (int m=2;m<=n;m++)
{
S_I[n][m]=S_I[n-1][m-1]-(n-1)*S_I[n-1][m];
}
}
void Stirling_Speta_II ()
{
S_II[1][1]=1;
for (int n=1;n<NMax;n++)
for (int m=2;m<=n;m++)
{
S_II[n][m]=S_II[n-1][m-1]-(n-1)*S_II[n-1][m];
}
}
int main()
{
int i,j;
int T;
in>>T;
while (T)
{
int op;
in>>op>>i>>j;
if(op==1)
{
out<<S_I[i][j];
continue;
}
out<<S_II[i][j];
T--;
}
return 0;
}