| 220 | return (differentiate().mod_xk(n) * inverse(n)).integrate().mod_xk(n); |
| 221 | } |
| 222 | poly exp(int n) const { //e ^ p(x) mod x^n |
| 223 | if(is_zero()) return {1}; |
| 224 | assert(a[0] == 0); |
| 225 | poly ans({1}); |
| 226 | int i = 1; |
| 227 | while(i < n) { |
| 228 | poly C = ans.log(2 * i).div_xk(i) - substr(i, 2 * i); |
| 229 | ans -= (ans * C).mod_xk(i).mul_xk(i); |
| 230 | i *= 2; |
| 231 | } |
| 232 | return ans.mod_xk(n); |
| 233 | } |
| 234 | }; |
| 235 | // number of subsets of an array of n elements having sum equal to k for each k from 1 to m |
| 236 | int32_t main() { |