Pagini recente » Cod sursa (job #2142066) | Cod sursa (job #2481894) | Cod sursa (job #2308199) | Cod sursa (job #624014) | Cod sursa (job #1349900)
#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[0][0]=1;
for (int n=1;n<NMax;n++)
for (int m=1;m<NMax;m++)
{
S_I[n][m]=S_I[n-1][m-1]-(n-1)*S_I[n-1][m];
}
}
void Stirling_Speta_II ()
{
S_II[0][0]=1;
for (int n=1;n<NMax;n++)
for (int m=1;m<NMax;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;
}