loj2325"Tsinghua Training 2017" Little Y and the horrible slave Lord
Original title address : https://loj.ac/problem/2325
Test Instructions:
"A fight?" Count me in! "to fight, count me in."
"Everyone, get in here!" everybody, come here.
Little Y is a oier who likes to play games. One day, she is playing a game, to play a boss.
Although the boss has 10100 10 100 10^{100} Points of health, it has only one attendant-a "horrible slave owner" with only M-m points of health.
This "horrible slave owner" has a special skill: whenever it is deducted from health but not dead (death is the health value ≤0≤0 \leq 0), and the boss's entourage is less than the upper limit K K K, it will summon a new "terror Slave" with M m points of health.
Now small y can do n n n attacks, each time the attack, from the boss and all the boss of the same probability of a random selection, and deduction of 1 1 1 points of health, she wants to know the n n n attacks after the boss's health points deduction of the expectation. To avoid accuracy errors, your answer needs to be modulo 998244353 998244353 998244353.
Data Range
1≤t≤1000,1≤n≤1018,1≤m≤3,1≤k≤8 1≤t≤1000, 1≤n≤10 18, 1≤m≤3, 1≤k≤8 1≤t≤1000,1≤n≤10^{18}, 1≤m≤3,1≤k≤8
The following:
The simplest DP, using the probability to calculate the expectation, record the first round, respectively, there are j,k,l of blood for the slave owner of the probability.
Dp[i+1][j′][k′][l′]+=k/j/lj+k+l+1dp[i][j][k][l] D p [i + 1] [j′] [k′] [l′] + = k/j/L j + k + L + 1 D p [i] [j] [K] [l] dp[i+1][j '][k '][l ']+=\frac{k/j/l}{j+k+l+1}dp[i][j][k][l],
each state has