[Los] to play the game Valley p4705

Subject to the effect

A length \ (n-\) sequence \ (A \) and a length \ (m \) sequence \ (B \) , for \ (1..t \) each \ (K \) , seek
\ [\ FRAC {. 1} {nm} \ sum_ {X =. 1} ^ n-\ sum_ {Y =. 1} ^ m (a_x + b_y) ^ K \]
\ (n-, m, T \ Leq 10 ^. 5 \ )

answer

\ [\ Begin {aligned} ans & = \ frac {1} {nm} \ sum_ {x = 1} ^ n \ sum_ {y = 1} ^ m \ sum_ {i = 0} ^ k {k \ choose i} a_x ^ i b_y ^ {ki} \\ & = \ frac {1} {nm} \ sum_ {i = 0} ^ k \ sum_ {x = 1} ^ n \ sum_ {y = 1} ^ m {k \ choose i} a_x ^ i b_y ^ {ki} \\ & = \ frac {k!} {nm} \ sum_ {i = 0} ^ k \ sum \ frac {a ^ i} {i!} \ sum \ frac {b ^ {ki}} {
(ki)!} \ end {aligned} \] how to consider for all \ (K \) obtaining \ (\ sum_ {J}. 1 = n-a_j ^ I ^ \) .
Write \ (OGF \) transformed enumeration order.
\ [\ Begin {aligned} A & = \ sum_ {i = 0} ^ \ infty x ^ i \ sum_ {j = 1} ^ n a_j ^ i \\ & = \ sum_ {i = 1} ^ n \ sum_ { j = 0} ^ \ infty a_i
^ jx ^ j \\ & = \ sum_ {i = 1} ^ n \ frac {1} {1-a_ix} \ end {aligned} \] In fact, here the partition can then pass points, but the constant is relatively large.
If the function nesting familiar stuff Derivative then conceivable \ (ln (1-ax) '= \ frac {-a} {1-ax} \)
\ [\ Begin {aligned} A & = \ sum \ frac {1} {1-ax} \\ & = \ sum 1-x \ frac {-a} {1-ax} \\ & = nx \ sum ln ( 1-ax) '\\ & =
nx * ln (\ prod 1-ax)' \ end {aligned} \] partition after obtaining the required product can be obtained with a back \ (A, B \) , direct roll the product can be.

Guess you like

Origin www.cnblogs.com/zzqtxdy/p/12081287.html