SRM663

Posted on 2015-07-27 01:24:30 +0900 in Contest Topcoder

ChangingChange

Analyze

The constraint on D is the key to solve this problem.

As different ways are given, Generating function would be a great tool to hold all the info all at once.

Suppose ways = {1, 3, 6, 2}, then

By adding a coin whose value is 1, then new ways is

On the contrary, by removing a coin whose value is 1, the new ways is

By removing n coins, the new ways is

The coefficient of $x^k$ is which has to be developed.

$\implies$

The final answer would be

----------------------------------- 本文内容遵从CC版权协议转载请注明出自kamelzcs -----------------------------------
«  | Function_overriding in Java vs C++ »

Hide Comments

comments powered by Disqus