题意
做法
EGF:(G(x)=sumlimits_{i}[d|i]frac{x^i}{i!})
(d=2)时:(G(x)=frac{e^{x}+e^{-x}}{2}),(G(x)^k[x^n])可以二项式定理后把每个项算([x^n])
(d=3)时:(G(x)=sumlimits_{i}[d|i]frac{x^i}{i!}=frac{1}{d}sumlimits_{i}sumlimits_{j=0}^{d-1}omega_d^{ij}frac{x^i}{i!}=frac{1}{d}sumlimits_{j=0}^{d-1}e^{omega_d^jcdot x})
(Ans=n!frac{1}{d^k}(sumlimits_{j=0}^{d-1}e^{omega_d^jcdot x})^k),由于(kle 1000,d=3),可以枚举(e^{omega_3^0cdot x},e^{omega_3^1cdot x},e^{omega_3^2cdot x})的个数