Pagini recente » Cod sursa (job #1267957) | Cod sursa (job #1734987) | Cod sursa (job #2982355) | Cod sursa (job #2929538) | Cod sursa (job #3239606)
#include <fstream>
using namespace std;
ifstream in("stirling.in");
ofstream out("stirling.out");
int teste, speta, n, m;
int stirling[2][202][202];
int main(){
in>>teste;
stirling[0][1][1] = 1;
stirling[1][1][1] = 1;
for(int i = 2; i < 202; i++){
for(int j = 1; j <= i; j++){
stirling[0][i][j] = (stirling[0][i - 1][j - 1] - ((i - 1) * stirling[0][i - 1][j])) % 98999;
stirling[1][i][j] = (stirling[1][i - 1][j - 1] + (j * stirling[1][i - 1][j])) % 98999;
}
}
for(int i = 1; i <= teste; i++)
in>>speta>>n>>m, out<<stirling[speta - 1][n][m]<<"\n";
return 0;
}