Problem 2787 · Medium

Ways to Express an Integer as Sum of Powers

Treat each base whose power fits as a 0/1 item and count the ways to reach n exactly, using a knapsack table.

Open the interactive visualisation