Pagini recente » Cod sursa (job #2038506) | Cod sursa (job #697306) | Cod sursa (job #1147142) | Cod sursa (job #497908) | Cod sursa (job #1349896)
#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];
}
if (op==2)
out<<S_II[i][j];
T--;
}
return 0;
}