Cod sursa(job #2283292)
| Utilizator | Data | 15 noiembrie 2018 12:38:25 | |
|---|---|---|---|
| Problema | Numerele lui Stirling | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.61 kb |
#include <bits/stdc++.h>
using namespace std;
const int mod=98999;
int d[2][210][210];
int main()
{
freopen("stirling.in","r",stdin);
freopen("stirling.out","w",stdout);
int t,n,m,x;
scanf("%d",&t);
d[0][0][0]=d[1][0][0]=1;
for(int i=1;i<=200;i++)
for(int j=1;j<=i;j++)
{
d[0][i][j]=(1LL*d[0][i-1][j-1]-1LL*(i-1)*d[0][i-1][j])%mod;
d[1][i][j]=(1LL*d[1][i-1][j-1]+1LL*j*d[1][i-1][j])%mod;
}
for(int test=1;test<=t;test++)
{
scanf("%d%d%d",&x,&n,&m);
printf("%d\n",d[x-1][n][m]);
}
return 0;
}
