Help me with this DP problem

Revision en1, by thanhchauns2, 2021-04-20 14:59:47

Given an array with N elements and a number P (P ≤ N). Pick randomly P elements from the array, let's call T the product of these elements. Find the largest x that T % 10^x = 0

Example:

Input

3 2

26 5 96

Output

1

Input

3 2

25 4 90

Output

2

Tags # dp, 1500, #array

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English thanhchauns2 2021-04-20 14:59:47 300 Initial revision (published)