← Back to topics
Topic

z-first-grade

m
matteo123
Can I get some hint, I don't understand the task, please.
h
halil
After the first day you have a K^a, so that a K^a\leq N.

After the second and all other days make all combination of size from the previos dasy and by multiplying them with K^a and have you length K^a(K^b\pm K^c), so that \leq N.

One of the possible approach is using dynamic programming, which can be very slow for the big N (N \approx 50.000). For the bigger N, may be that method can be improved, but I do not know how.