Help me with this DP problem

Правка en1, от 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

Теги # dp, 1500, #array

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский thanhchauns2 2021-04-20 14:59:47 300 Initial revision (published)