Pagini recente » Cod sursa (job #341998) | Cod sursa (job #3209801) | Cod sursa (job #322422) | Cod sursa (job #2649975) | Cod sursa (job #3239605)
#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 < n; 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;
}