Pagini recente » Cod sursa (job #1377588) | Cod sursa (job #1086217) | Cod sursa (job #1125358) | Cod sursa (job #2461829) | Cod sursa (job #1412147)
#include <bits/stdc++.h>
#define mod 98999
using namespace std;
int s[205][205], S[205][205], i, j, n, t, x, y, tip;
int main()
{
freopen("stirling.in", "r", stdin);
freopen("stirling.out", "w", stdout);
s[0][0] = S[0][0] = 1;
for(i = 1; i <= 200; i++)
for(j = 1; j <= i; j++)
{
s[i][j] = (1ll * s[i - 1][j - 1] - 1ll * (i - 1) * s[i - 1][j]) % mod;
S[i][j] = (1ll * S[i - 1][j - 1] + 1ll * j * S[i - 1][j]) % mod;
}
scanf("%d", &t);
for(; t; t--)
{
scanf("%d%d%d", &tip, &x, &y);
tip == 1 ? printf("%d\n", s[x][y]) : printf("%d\n", S[x][y]);
}
return 0;
}